Skip to content

Commit 4b6fe77

Browse files
authored
Convert requirements compile script to Python (#615)
This is to make it work whichever directory it's run from - something that's hard in a shell script.
1 parent 89425d9 commit 4b6fe77

18 files changed

+237
-37
lines changed

requirements/compile.py

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
#!/usr/bin/env python
2+
import os
3+
import subprocess
4+
import sys
5+
from pathlib import Path
6+
7+
8+
if __name__ == "__main__":
9+
os.chdir(Path(__file__).parent)
10+
os.environ["CUSTOM_COMPILE_COMMAND"] = "requirements/compile.py"
11+
common_args = ["-m", "piptools", "compile", "--generate-hashes"] + sys.argv[1:]
12+
# mysqlclient requirements found on each version's "Databases" documentation page:
13+
# https://docs.djangoproject.com/en/2.2/ref/databases/#id6
14+
subprocess.run(
15+
[
16+
"python3.5",
17+
*common_args,
18+
"-P",
19+
"Django>=1.11,<2.0",
20+
"-P",
21+
"mysqlclient>=1.3.3,<=1.3.13",
22+
"-o",
23+
"py35-django111.txt",
24+
],
25+
check=True,
26+
)
27+
subprocess.run(
28+
[
29+
"python3.5",
30+
*common_args,
31+
"-P",
32+
"Django>=2.0,<2.1",
33+
"-P",
34+
"mysqlclient>=1.3.7,<=1.3.13",
35+
"-o",
36+
"py35-django20.txt",
37+
],
38+
check=True,
39+
)
40+
subprocess.run(
41+
[
42+
"python3.5",
43+
*common_args,
44+
"-P",
45+
"Django>=2.1,<2.2",
46+
"-P",
47+
"mysqlclient>=1.3.7",
48+
"-o",
49+
"py35-django21.txt",
50+
],
51+
check=True,
52+
)
53+
subprocess.run(
54+
[
55+
"python3.5",
56+
*common_args,
57+
"-P",
58+
"Django>=2.2,<2.3",
59+
"-P",
60+
"mysqlclient>=1.3.13",
61+
"-o",
62+
"py35-django22.txt",
63+
],
64+
check=True,
65+
)
66+
subprocess.run(
67+
[
68+
"python3.6",
69+
*common_args,
70+
"-P",
71+
"Django>=1.11,<2.0",
72+
"-P",
73+
"mysqlclient>=1.3.3,<=1.3.13",
74+
"-o",
75+
"py36-django111.txt",
76+
],
77+
check=True,
78+
)
79+
subprocess.run(
80+
[
81+
"python3.6",
82+
*common_args,
83+
"-P",
84+
"Django>=2.0,<2.1",
85+
"-P",
86+
"mysqlclient>=1.3.7,<=1.3.13",
87+
"-o",
88+
"py36-django20.txt",
89+
],
90+
check=True,
91+
)
92+
subprocess.run(
93+
[
94+
"python3.6",
95+
*common_args,
96+
"-P",
97+
"Django>=2.1,<2.2",
98+
"-P",
99+
"mysqlclient>=1.3.7",
100+
"-o",
101+
"py36-django21.txt",
102+
],
103+
check=True,
104+
)
105+
subprocess.run(
106+
[
107+
"python3.6",
108+
*common_args,
109+
"-P",
110+
"Django>=2.2,<2.3",
111+
"-P",
112+
"mysqlclient>=1.3.13",
113+
"-o",
114+
"py36-django22.txt",
115+
],
116+
check=True,
117+
)
118+
subprocess.run(
119+
[
120+
"python3.6",
121+
*common_args,
122+
"-P",
123+
"Django>=3.0a1,<3.1",
124+
"-P",
125+
"mysqlclient>=1.3.13",
126+
"-o",
127+
"py36-django30.txt",
128+
],
129+
check=True,
130+
)
131+
subprocess.run(
132+
[
133+
"python3.7",
134+
*common_args,
135+
"-P",
136+
"Django>=1.11,<2.0",
137+
"-P",
138+
"mysqlclient>=1.3.3,<=1.3.13",
139+
"-o",
140+
"py37-django111.txt",
141+
],
142+
check=True,
143+
)
144+
subprocess.run(
145+
[
146+
"python3.7",
147+
*common_args,
148+
"-P",
149+
"Django>=2.0,<2.1",
150+
"-P",
151+
"mysqlclient>=1.3.7,<=1.3.13",
152+
"-o",
153+
"py37-django20.txt",
154+
],
155+
check=True,
156+
)
157+
subprocess.run(
158+
[
159+
"python3.7",
160+
*common_args,
161+
"-P",
162+
"Django>=2.1,<2.2",
163+
"-P",
164+
"mysqlclient>=1.3.7",
165+
"-o",
166+
"py37-django21.txt",
167+
],
168+
check=True,
169+
)
170+
subprocess.run(
171+
[
172+
"python3.7",
173+
*common_args,
174+
"-P",
175+
"Django>=2.2,<2.3",
176+
"-P",
177+
"mysqlclient>=1.3.13",
178+
"-o",
179+
"py37-django22.txt",
180+
],
181+
check=True,
182+
)
183+
subprocess.run(
184+
[
185+
"python3.7",
186+
*common_args,
187+
"-P",
188+
"Django>=3.0a1,<3.1",
189+
"-P",
190+
"mysqlclient>=1.3.13",
191+
"-o",
192+
"py37-django30.txt",
193+
],
194+
check=True,
195+
)
196+
subprocess.run(
197+
[
198+
"python3.8",
199+
*common_args,
200+
"-P",
201+
"Django>=2.2,<2.3",
202+
"-P",
203+
"mysqlclient>=1.3.13",
204+
"-o",
205+
"py38-django22.txt",
206+
],
207+
check=True,
208+
)
209+
subprocess.run(
210+
[
211+
"python3.8",
212+
*common_args,
213+
"-P",
214+
"Django>=3.0a1,<3.1",
215+
"-P",
216+
"mysqlclient>=1.3.13",
217+
"-o",
218+
"py38-django30.txt",
219+
],
220+
check=True,
221+
)

requirements/compile.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

requirements/py35-django111.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile
33
# To update, run:
44
#
5-
# ./compile.sh
5+
# requirements/compile.py
66
#
77
attrs==19.3.0 \
88
--hash=sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c \

requirements/py35-django20.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile
33
# To update, run:
44
#
5-
# ./compile.sh
5+
# requirements/compile.py
66
#
77
attrs==19.3.0 \
88
--hash=sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c \

requirements/py35-django21.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile
33
# To update, run:
44
#
5-
# ./compile.sh
5+
# requirements/compile.py
66
#
77
attrs==19.3.0 \
88
--hash=sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c \

requirements/py35-django22.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile
33
# To update, run:
44
#
5-
# ./compile.sh
5+
# requirements/compile.py
66
#
77
attrs==19.3.0 \
88
--hash=sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c \

requirements/py36-django111.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile
33
# To update, run:
44
#
5-
# ./compile.sh
5+
# requirements/compile.py
66
#
77
attrs==19.3.0 \
88
--hash=sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c \

requirements/py36-django20.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile
33
# To update, run:
44
#
5-
# ./compile.sh
5+
# requirements/compile.py
66
#
77
attrs==19.3.0 \
88
--hash=sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c \

requirements/py36-django21.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile
33
# To update, run:
44
#
5-
# ./compile.sh
5+
# requirements/compile.py
66
#
77
attrs==19.3.0 \
88
--hash=sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c \

requirements/py36-django22.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile
33
# To update, run:
44
#
5-
# ./compile.sh
5+
# requirements/compile.py
66
#
77
attrs==19.3.0 \
88
--hash=sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c \

0 commit comments

Comments
 (0)