2018-09-02 15:54:18 +10:00
|
|
|
#!/usr/bin/env python3.7
|
2015-12-26 20:52:39 +00:00
|
|
|
|
2018-01-12 15:00:39 +10:00
|
|
|
# Copyright (C) 2018 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
|
2017-06-27 14:03:32 +01:00
|
|
|
import vigil.tools
|
2015-12-26 20:52:39 +00:00
|
|
|
|
|
|
|
|
|
2017-05-17 16:46:54 +01:00
|
|
|
pip_deps, pip3_deps, dist_deps = set(), set(), set()
|
2017-09-01 21:53:02 +01:00
|
|
|
for dependency in vigil.tools.dependencies():
|
2017-05-17 16:46:54 +01:00
|
|
|
if "/" in dependency:
|
|
|
|
|
pip_version, pip_dependency = dependency.split("/")
|
|
|
|
|
(pip_deps if pip_version == "pip" else pip3_deps).add(pip_dependency)
|
|
|
|
|
else:
|
|
|
|
|
dist_deps.add(dependency)
|
2017-09-01 21:53:02 +01:00
|
|
|
if pip_deps:
|
|
|
|
|
dist_deps.add("python-pip")
|
2017-05-17 16:46:54 +01:00
|
|
|
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-02 15:54:18 +10:00
|
|
|
subprocess.run(["python", "-m", "pip", "install"] + list(pip_deps),
|
2018-03-24 16:34:49 +10:00
|
|
|
check=True)
|
2017-05-17 16:46:54 +01:00
|
|
|
if pip3_deps:
|
2018-09-02 15:54:18 +10:00
|
|
|
subprocess.run(["python" + vigil.tools.PYTHON_VERSION, "-m", "pip",
|
|
|
|
|
"install"] + list(pip3_deps), check=True)
|