Created
January 10, 2023 14:26
-
-
Save piusayowale/a14633b3f11e45dfe0e5a85cf9c7a926 to your computer and use it in GitHub Desktop.
get list of packages and their descriptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
import sys | |
import codecs | |
sys.stdout = codecs.getwriter('utf8')(sys.stdout) | |
def save(dat): | |
with open('dump', 'a') as file: | |
file.write(dat) | |
#file.close() | |
def readfile(file): | |
f = open(file, "r") | |
return f.read() | |
def parseDes(input): | |
js = readfile(input) | |
parsed = json.loads(js) | |
save(parsed["name"] + ": ") | |
try: | |
desc = parsed["description"] | |
if(desc is not None): | |
save(desc) | |
save("\r\n\n") | |
except: | |
pass | |
directory = "/vcpkg/ports" | |
for filename in os.listdir(directory): | |
temp = os.path.join(directory, filename) | |
f = os.path.join(temp, "vcpkg.json") | |
if(os.path.isfile(f)): | |
parseDes(f) | |
print("Done!") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment