-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdependencies.py
More file actions
executable file
·40 lines (33 loc) · 855 Bytes
/
dependencies.py
File metadata and controls
executable file
·40 lines (33 loc) · 855 Bytes
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
#!/usr/bin/env python3
# download javascript dependencies
import sys
import os.path
import subprocess
from config import bower
dependencies = [
(
"jquery#~2.2.1",
"bower_components/jquery/dist/jquery.min.js"
),
(
"jquery-ui#~1.11.4",
"bower_components/jquery-ui/jquery-ui.min.js"
),
(
"undo-manager#~1.0.5",
"bower_components/undo-manager/lib/undomanager.js"
)
]
def resolve(basedir=sys.path[0], dependencies=dependencies):
for (name, filename) in dependencies:
if not os.path.isfile(os.path.join(basedir, filename)):
try:
subprocess.check_call([ bower, "install", name ], cwd=basedir)
except Exception as e:
print("Could not download %s (bower install %s)!" % (name, name), file=sys.stderr)
print(e, file=sys.stderr)
return False
return True
if __name__ == "__main__":
if not resolve():
sys.exit(2)