fix directory structure

This commit is contained in:
Alek Westover
2023-07-11 13:52:19 -04:00
parent 13fa5285af
commit f37980a026
2 changed files with 15 additions and 14 deletions

View File

@@ -1,14 +1,16 @@
import json
import os
index = {}
ext_index = {}
os.chdir("control_files")
for prefix in os.listdir("."):
ext_index[prefix] = {}
for file in os.listdir(prefix):
with open(os.path.join(prefix, file), "r") as f:
ext_name = file.replace(".control", "")
control = f.read()
index[ext_name] = {"path": f"{prefix}/{ext_name}.tar.gz", "control": control}
ext_index[prefix][ext_name] = {"path": f"extensions/{prefix}/{ext_name}.tar.gz", "control": control}
with open("../ext_index.json", "w") as f:
json.dump(ext_index, f)
with open("../control_index.json", "w") as f:
json.dump(index, f)