-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathpackage.py
51 lines (40 loc) · 1.25 KB
/
package.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
51
#!/usr/bin/env python3
import os.path
from os import path
import json
projects = {}
with open("projects.json") as f:
projects = json.load(f)
index_json = {
"packages": []
}
for i, project in enumerate(projects):
# Meta data
project_json = {
"name": project,
"maintainer": "Spacehuhn Technologies",
"websiteURL": "https://spacehuhn.tech",
"email": "support@spacehuhn.tech",
"help": {
"online": f"https://github.com/spacehuhntech",
},
"platforms": [],
"tools": [],
}
# Platforms
for package in projects[project]:
platform_file = f"{project}/{package}-platform.json"
if path.exists(platform_file):
with open(platform_file) as f:
platforms = json.load(f)
for p in platforms:
project_json["platforms"].append(p)
# Tools
tools_file = f"{project}/{package}/tools.json"
with open(tools_file) as f:
tools = json.load(f)
for t in tools:
project_json["tools"].append(t)
index_json["packages"].append(project_json)
with open("package_spacehuhn_index.json", "w") as f:
f.write(json.dumps(index_json, indent=4))