forked from Shuffle/python-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
analyze.py
31 lines (26 loc) · 979 Bytes
/
analyze.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
import yaml
import os
dirs = os.listdir(".")
#print(dirs)
#basename = "testing"
for basename in dirs:
try:
versions = os.listdir("./%s" % basename)
except NotADirectoryError:
continue
for version in versions:
filepath = "%s/%s/api.yaml" % (basename, version)
try:
with open(filepath, "r") as tmp:
ret = yaml.load(tmp.read())
newname = ret["name"].lower().replace(" ", "-", -1).replace(".", "-", -1)
if newname != basename:
print("Bad name: %s vs %s" % (basename, newname))
if ret["app_version"] != version:
print("Bad version (%s): %s vs %s" % (basename, version, ret["app_version"]))
#else:
# print("%s:%s is valid" % (basename, version))
except (NotADirectoryError, FileNotFoundError) as e:
#print("Error inner file: %s" % e)
pass
#for item in