This repository has been archived by the owner on Feb 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
install.py
45 lines (36 loc) · 1.53 KB
/
install.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
if __name__ == '__main__':
import pip
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
FILES = []
def collect(fn):
FILES.append("-r")
FILES.append(fn)
try:
import yaml
except ImportError:
pip.main(["install", "PyYAML"])
import yaml
with open("config.yml") as reader:
config = yaml.safe_load(reader)
if os.environ.get("BEAVY_ENV", None):
print("----- Adding basic requirements")
collect(os.path.join(BASE_DIR, "beavy", "requirements", "base.txt"))
if os.environ.get("BEAVY_ENV", None) == "PRODUCTION":
print("----- Adding production requirements")
collect(os.path.join(BASE_DIR, "beavy", "requirements",
"production.txt"))
elif os.environ.get("BEAVY_ENV", None) in ["TEST", "DEV", "DEBUG"]:
print("----- Adding dev requirements")
collect(os.path.join(BASE_DIR, "beavy", "requirements", "dev.txt"))
else:
print("----- Adding dev requirements")
collect(os.path.join(BASE_DIR, "beavy", "requirements", "base.txt"))
collect(os.path.join(BASE_DIR, "beavy", "requirements", "dev.txt"))
for module in (config["MODULES"] or ()):
filename = os.path.join(BASE_DIR,
"beavy_modules", module, "requirements.txt")
if os.path.exists(filename):
print("----- Adding Requirements for {}".format(module))
collect(filename)
exit(pip.main(["install"] + FILES))