2018-07-20 04:11:41 -04:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
2020-04-06 14:25:11 -04:00
|
|
|
import subprocess
|
2018-07-20 04:11:41 -04:00
|
|
|
from collections import OrderedDict
|
|
|
|
|
|
|
|
|
|
|
|
current_path = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
|
|
|
|
# name, (url, recursive clone, develop)
|
|
|
|
repos = [
|
2019-08-26 03:27:19 -04:00
|
|
|
# HDL
|
2020-04-06 19:49:52 -04:00
|
|
|
("migen", ("https://github.com/m-labs/", True, True)),
|
2019-08-26 03:27:19 -04:00
|
|
|
|
|
|
|
# LiteX SoC builder
|
2020-04-06 19:49:52 -04:00
|
|
|
("litex", ("https://github.com/enjoy-digital/", True, True)),
|
2019-08-26 03:27:19 -04:00
|
|
|
|
|
|
|
# LiteX cores ecosystem
|
2019-10-04 04:00:45 -04:00
|
|
|
("liteeth", ("https://github.com/enjoy-digital/", False, True)),
|
|
|
|
("litedram", ("https://github.com/enjoy-digital/", False, True)),
|
|
|
|
("litepcie", ("https://github.com/enjoy-digital/", False, True)),
|
|
|
|
("litesata", ("https://github.com/enjoy-digital/", False, True)),
|
|
|
|
("litesdcard", ("https://github.com/enjoy-digital/", False, True)),
|
|
|
|
("liteiclink", ("https://github.com/enjoy-digital/", False, True)),
|
|
|
|
("litevideo", ("https://github.com/enjoy-digital/", False, True)),
|
|
|
|
("litescope", ("https://github.com/enjoy-digital/", False, True)),
|
|
|
|
("litejesd204b", ("https://github.com/enjoy-digital/", False, True)),
|
2020-03-30 07:37:34 -04:00
|
|
|
("litespi", ("https://github.com/litex-hub/", False, True)),
|
2019-08-26 03:27:19 -04:00
|
|
|
|
|
|
|
# LiteX boards support
|
2020-04-06 19:49:52 -04:00
|
|
|
("litex-boards", ("https://github.com/litex-hub/", False, True)),
|
2018-07-20 04:11:41 -04:00
|
|
|
]
|
|
|
|
repos = OrderedDict(repos)
|
|
|
|
|
|
|
|
if len(sys.argv) < 2:
|
|
|
|
print("Available commands:")
|
|
|
|
print("- init")
|
2019-04-23 08:53:00 -04:00
|
|
|
print("- install (add --user to install to user directory)")
|
2018-07-20 04:11:41 -04:00
|
|
|
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 ""
|
2020-04-06 14:25:11 -04:00
|
|
|
subprocess.check_call(
|
|
|
|
"git clone " + full_url + " " + opts,
|
|
|
|
shell=True)
|
2018-07-20 04:11:41 -04:00
|
|
|
|
|
|
|
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))
|
2019-04-23 08:53:00 -04:00
|
|
|
if "--user" in sys.argv[1:]:
|
2020-04-06 14:25:11 -04:00
|
|
|
subprocess.check_call(
|
|
|
|
"python3 setup.py develop --user",
|
|
|
|
shell=True)
|
2019-04-23 08:53:00 -04:00
|
|
|
else:
|
2020-04-06 14:25:11 -04:00
|
|
|
subprocess.check_call(
|
|
|
|
"python3 setup.py develop",
|
|
|
|
shell=True)
|
2018-07-20 04:11:41 -04:00
|
|
|
|
|
|
|
if "update" in sys.argv[1:]:
|
|
|
|
for name in repos.keys():
|
|
|
|
# update
|
|
|
|
print("[updating " + name + "]...")
|
|
|
|
os.chdir(os.path.join(current_path, name))
|
2020-04-06 14:25:11 -04:00
|
|
|
subprocess.check_call(
|
|
|
|
"git pull",
|
|
|
|
shell=True)
|