Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import widlparser
- browser = 'firefox'
- if browser == 'firefox':
- webidl_path = "/Users/vinyldarkscratch/Developer/git/gecko-dev"
- elif browser == 'chrome':
- webidl_path = "/Users/vinyldarkscratch/Developer/git/chromium/src"
- elif browser == 'safari':
- webidl_path = "/Users/vinyldarkscratch/Developer/WebKit"
- data = ""
- with open("/Users/vinyldarkscratch/Desktop/%s_null.txt" %browser) as f:
- entries_to_check = [l.replace("\n", "") for l in f.readlines() if l.startswith("api.")]
- def dir_walk(path):
- response = []
- for root, subdirs, files in os.walk(path):
- response += [os.path.join(root, f) for f in files if (f.endswith('.idl') or f.endswith('.webidl'))]
- for s in subdirs:
- response += dir_walk(s)
- return response
- def check_entry(entry):
- e = entry.split(".")
- for w in widl:
- if w.name == e[1]:
- if len(e) == 2:
- return "true"
- else:
- if hasattr(w, 'members'):
- for m in w.members:
- if m.name == e[2] and len(e) == 3:
- return "true"
- return "null"
- files = sorted(dir_walk(webidl_path))
- for fn in files:
- with open(os.path.join(webidl_path, fn), 'r') as f:
- new_data = f.read()
- data += new_data
- widl = widlparser.parser.Parser(data)
- for entry in entries_to_check:
- c = check_entry(entry)
- print("%s - %s" %(entry, c))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement