forked from locationtech/geotrellis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollect-dependecies.py
executable file
·75 lines (56 loc) · 2.35 KB
/
collect-dependecies.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import os, re
import subprocess
projects = ["spark-etl",
"slick",
"shapefile",
"raster-testkit",
"vector-testkit",
"spark-testkit"]
org_flags = { "org.apache.accumulo": "accumulo",
"org.geotools": "geotools",
"com.typesafe.akka": "akka" }
ignore = [ ("org.locationtech.geotrellis", None, None) ]
if __name__ == "__main__":
deps = set([])
lines = []
org_flag_indent = -1
curr_org_flag = ""
for project in projects:
print "Checking %s..." % project
output = subprocess.check_output(['./sbt "project %s" dependencyGraph' % (project)], shell=True)
for line in output.split('\n'):
if not 'evicted' in line:
m = re.search(r"""(.*)\+-([^:]+):([^:]+):([\d.]+)""", line)
if m:
lines.append(line)
org = m.group(2)
name = m.group(3)
version = m.group(4)
this_indent = m.group(1).count('|')
if name == "kryo":
print "KRYO %s %s %s" % (org, name, version)
if name == "protobuf-java":
print "PROTOBUF %s %s %s" % (org, name, version)
if name == "jai_core":
print "JAI %s %s %s" % (org, name, version)
org_flag = ""
if org_flag_indent != -1:
if org_flag_indent < this_indent:
org_flag = curr_org_flag
else:
curr_org_flag = ""
org_flag_indent = -1
if org_flag == "":
if org in org_flags:
org_flag = org_flags[org]
curr_org_flag = org_flag
org_flag_indent = this_indent
dep = (m.group(2), m.group(3), m.group(4), org_flag)
if org_flag:
print "%s %s" % (' ' * this_indent, str(dep))
deps.add(dep)
s = '"org","name","version","flag"\n'
for dep in sorted(deps):
s += '"%s","%s","%s","%s"\n' % dep
open('dependency-list.csv', 'w').write(s)
open('dependency-list.txt', 'w').write('\n'.join(lines))