2018-09-02 15:54:18 +10:00
|
|
|
#!/usr/bin/env python3.7
|
2015-12-26 20:52:39 +00:00
|
|
|
|
2019-02-04 11:48:47 +10:00
|
|
|
# Copyright (C) 2015-2019 Andrew Hamilton. All rights reserved.
|
2017-06-01 01:03:39 +01:00
|
|
|
# Licensed under the Artistic License 2.0.
|
|
|
|
|
|
2015-12-26 20:52:39 +00:00
|
|
|
|
|
|
|
|
import subprocess
|
2018-09-17 23:59:38 +10:00
|
|
|
import eris.tools
|
2015-12-26 20:52:39 +00:00
|
|
|
|
|
|
|
|
|
2019-07-01 14:01:29 +10:00
|
|
|
pip_deps, go_deps, luarocks_deps, dist_deps, git_deps = set(), set(), set(), \
|
|
|
|
|
set(), set()
|
|
|
|
|
dep_types = {"pip": pip_deps, "go": go_deps, "luarocks": luarocks_deps,
|
|
|
|
|
"git": git_deps}
|
2018-09-17 23:59:38 +10:00
|
|
|
for dependency in eris.tools.dependencies():
|
2017-05-17 16:46:54 +01:00
|
|
|
if "/" in dependency:
|
2019-06-06 18:53:57 +10:00
|
|
|
dep_type, dep = dependency.split("/", maxsplit=1)
|
|
|
|
|
dep_types[dep_type].add(dep)
|
2017-05-17 16:46:54 +01:00
|
|
|
else:
|
|
|
|
|
dist_deps.add(dependency)
|
|
|
|
|
if dist_deps:
|
2018-03-24 16:34:49 +10:00
|
|
|
subprocess.run(["sudo", "apt-get", "-y", "install"] + list(dist_deps),
|
|
|
|
|
check=True)
|
2017-05-17 16:46:54 +01:00
|
|
|
if pip_deps:
|
2018-09-17 23:59:38 +10:00
|
|
|
subprocess.run(["python" + eris.tools.PYTHON_VERSION, "-m", "pip",
|
2019-01-21 11:46:51 +10:00
|
|
|
"install"] + list(pip_deps), check=True)
|
2019-06-06 18:53:57 +10:00
|
|
|
if go_deps:
|
|
|
|
|
subprocess.run(["sudo", "apt-get", "-y", "install", "golang-go"],
|
|
|
|
|
check=True)
|
2019-07-15 12:50:32 +10:00
|
|
|
subprocess.run(["go", "get"] + list(go_deps), check=True)
|
2019-06-24 13:09:27 +10:00
|
|
|
|
|
|
|
|
if luarocks_deps:
|
2019-07-15 12:50:32 +10:00
|
|
|
subprocess.run(["sudo", "apt-get", "-y", "install", "luarocks",
|
|
|
|
|
"liblua5.3-dev"], check=True)
|
2019-06-24 13:09:27 +10:00
|
|
|
subprocess.run(["sudo", "luarocks", "install"] + list(luarocks_deps),
|
|
|
|
|
check=True)
|