-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmake-package-info.py
26 lines (20 loc) · 1.23 KB
/
make-package-info.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
import json, os, subprocess
print "************************************************"
def filesinfolder(n):
return [f for f in os.listdir(n) if not f.startswith('.')]
with open('default-package-info.json', 'r') as f:
pinfo = json.load(f)
# update the package listings
# note: this runs after the archive script copies the files into the appropriate folders
pinfo['filelist']['externals'] = filesinfolder("CNMAT-Externals/externals")
pinfo['filelist']['java-classes'] = filesinfolder("CNMAT-Externals/java-classes")
pinfo['filelist']['help'] = filesinfolder("CNMAT-Externals/help")
pinfo['filelist']['media'] = filesinfolder("CNMAT-Externals/media")
pinfo['filelist']['misc'] = filesinfolder("CNMAT-Externals/misc")
pinfo['filelist']['docs'] = filesinfolder("CNMAT-Externals/docs/refpages/cnmat_ref")
pinfo['filelist']['extras'] = filesinfolder("CNMAT-Externals/extras/CNMAT-Externals")
version = subprocess.check_output("git describe --tags --long", shell=True).strip()
branch = subprocess.check_output("git branch | egrep '^\*' | awk '{print $2}'", shell=True).strip()
pinfo['version'] = version+"-"+branch
with open('package-info.json', 'w') as outf:
json.dump(pinfo, outf, indent=4)