generated from ScoopInstaller/BucketTemplate
-
Notifications
You must be signed in to change notification settings - Fork 26
/
checkver.py
50 lines (41 loc) · 963 Bytes
/
checkver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" @todo add docstring """
# ### imports ###
from __future__ import (
absolute_import,
division,
print_function, # ,
# unicode_literals
)
import fnmatch
import json
import re
import os
import sys
specs = sys.argv
specs.pop(0)
if len(specs) == 0:
specs = ["*.json"]
for file in os.listdir("bucket"):
accept = False
for spec in specs:
if fnmatch.fnmatch(file, spec):
accept = True
break
if not accept:
continue
with open(file, "r") as f:
j = json.load(f)
row = {}
(name, ext) = os.path.splitext(os.path.basename(file))
if re.search("^_", name):
continue
if "checkver" in j:
continue
if "homepage" in j:
url = j["homepage"]
else:
url = "https://www.google.com/search?q=" + name
print("%s: %s" % (name, url))
sys.exit(0)