forked from enjoy-digital/litex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
litex_setup.py
executable file
·58 lines (50 loc) · 2.05 KB
/
litex_setup.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
#!/usr/bin/env python3
import os
import sys
from collections import OrderedDict
current_path = os.path.dirname(os.path.realpath(__file__))
# name, (url, recursive clone, develop)
repos = [
("migen", ("http://github.com/m-labs/", True, True)),
("litex", ("http://github.com/enjoy-digital/", True, True)),
("liteeth", ("http://github.com/enjoy-digital/", False, True)),
("litedram", ("http://github.com/enjoy-digital/", False, True)),
("litepcie", ("http://github.com/enjoy-digital/", False, True)),
("litesata", ("http://github.com/enjoy-digital/", False, True)),
("litesdcard", ("http://github.com/enjoy-digital/", False, True)),
("liteiclink", ("http://github.com/enjoy-digital/", False, True)),
("litevideo", ("http://github.com/enjoy-digital/", False, True)),
("litescope", ("http://github.com/enjoy-digital/", False, True)),
]
repos = OrderedDict(repos)
if len(sys.argv) < 2:
print("Available commands:")
print("- init")
print("- install (add --user to install to user directory)")
print("- update")
exit()
if "init" in sys.argv[1:]:
for name in repos.keys():
url, need_recursive, need_develop = repos[name]
# clone repo (recursive if needed)
print("[cloning " + name + "]...")
full_url = url + name
opts = "--recursive" if need_recursive else ""
os.system("git clone " + full_url + " " + opts)
if "install" in sys.argv[1:]:
for name in repos.keys():
url, need_recursive, need_develop = repos[name]
# develop if needed
print("[installing " + name + "]...")
if need_develop:
os.chdir(os.path.join(current_path, name))
if "--user" in sys.argv[1:]:
os.system("python3 setup.py develop --user")
else:
os.system("python3 setup.py develop")
if "update" in sys.argv[1:]:
for name in repos.keys():
# update
print("[updating " + name + "]...")
os.chdir(os.path.join(current_path, name))
os.system("git pull")