-
Notifications
You must be signed in to change notification settings - Fork 27
/
generate_requirements.py
42 lines (35 loc) · 1.49 KB
/
generate_requirements.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
import argparse
# Versions will be fetched from the init of each package (portal, game) after they are installed in lib - this happens in the "Build" step.
from lib.game import __version__ as rapid_router_version
from lib.portal import __version__ as portal_version
parser = argparse.ArgumentParser()
parser.add_argument("--portal-branch")
parser.add_argument("--rapid-router-branch")
args = parser.parse_args()
if args.portal_branch:
portal_requirement = f"git+https://github.com/ocadotechnology/codeforlife-portal@{args.portal_branch}#egg=codeforlife-portal"
common_requirement = f"git+https://github.com/ocadotechnology/codeforlife-portal@{args.portal_branch}#egg=cfl-common&subdirectory=cfl_common"
else:
portal_requirement = f"codeforlife-portal=={portal_version}"
common_requirement = ""
if args.rapid_router_branch:
rapid_router_requirement = f"git+https://github.com/ocadotechnology/rapid-router@{args.rapid_router_branch}#egg=rapid-router"
else:
rapid_router_requirement = f"rapid-router=={rapid_router_version}"
requirements = "\n".join(
[
rapid_router_requirement,
portal_requirement,
common_requirement,
"requests-toolbelt==0.9.*",
"mysqlclient==2.1.*",
"redis==3.3.*",
"django-redis==4.11.*",
"google-cloud-logging==1.*",
"google-auth==1.*",
]
)
requirements_path = "requirements.txt"
requirements_file = open(requirements_path, "w")
requirements_file.write(requirements)
requirements_file.close()