-
Notifications
You must be signed in to change notification settings - Fork 0
/
vendored.py
61 lines (48 loc) · 1.4 KB
/
vendored.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""
Vendor required packages
Updating vendored packages:
- bump required package in `src/pyproject_installer/vendored.txt`
- run `python3 tools/vendored.py`
Currently there are no changes made on vendored packages.
To verify changes if any:
- tomli: https://github.com/hukkin/tomli.git
git diff 2.0.1:src/tomli @:src/pyproject_installer/_vendor/tomli
- packaging: https://github.com/pypa/packaging
git diff 23.1:src/packaging @:src/pyproject_installer/_vendor/packaging
"""
from pathlib import Path
import sys
import subprocess
import shutil
VENDORED_PATH = "src/pyproject_installer/_vendor"
BACKEND_VENDORED_PATH = "backend/_vendor"
def install(vendored_path):
install_args = [
sys.executable,
"-m",
"pip",
"install",
"--no-deps",
"--no-compile",
"-r",
vendored_path.parent / "vendored.txt",
"-t",
vendored_path,
]
subprocess.check_call(install_args)
(vendored_path / "__init__.py").touch()
def update_main():
vendored_path = Path(VENDORED_PATH)
if vendored_path.exists():
shutil.rmtree(vendored_path)
vendored_path.mkdir()
install(vendored_path)
def update_backend():
vendored_path = Path(BACKEND_VENDORED_PATH)
if vendored_path.exists():
shutil.rmtree(vendored_path)
vendored_path.mkdir()
install(vendored_path)
if __name__ == "__main__":
update_main()
update_backend()