-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathcompile.py
More file actions
executable file
·47 lines (45 loc) · 1.22 KB
/
compile.py
File metadata and controls
executable file
·47 lines (45 loc) · 1.22 KB
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
46
47
#!/usr/bin/env python
from __future__ import annotations
import os
import subprocess
import sys
from pathlib import Path
if __name__ == "__main__":
os.chdir(Path(__file__).parent)
os.environ["CUSTOM_COMPILE_COMMAND"] = "requirements/compile.py"
os.environ["PIP_REQUIRE_VIRTUALENV"] = "0"
common_args = [
"-m",
"piptools",
"compile",
"--allow-unsafe",
] + sys.argv[1:]
subprocess.run(
["python3.8", *common_args, "-o", "py38.txt"],
check=True,
capture_output=True,
)
subprocess.run(
["python3.9", *common_args, "-o", "py39.txt"],
check=True,
capture_output=True,
)
subprocess.run(
["python3.10", *common_args, "-o", "py310.txt"],
check=True,
capture_output=True,
)
subprocess.run(
["python3.11", *common_args, "-o", "py311.txt"],
check=True,
capture_output=True,
)
subprocess.run(
["python3.12", *common_args, "-o", "py312.txt"],
check=True,
capture_output=True,
)
for path in Path(".").glob("py*.txt"):
text = path.read_text()
text += "\n# Packages that can’t be pinned\ntensorflow\n"
path.write_text(text)