Debian Codegraph @

scripts/ci/install-dev-deps

raw
1 #!/usr/bin/env python
2 import os
3 import sys
4 from contextlib import contextmanager
5 from subprocess import check_call
6
7 _dname = os.path.dirname
8
9 REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__))))
10
11
12 @contextmanager
13 def cd(path):
14 """Change directory while inside context manager."""
15 cwd = os.getcwd()
16 try:
17 os.chdir(path)
18 yield
19 finally:
20 os.chdir(cwd)
21
22
23 def run(command):
24 return check_call(command, shell=True)
25
26
27 if __name__ == "__main__":
28 with cd(REPO_ROOT):
29 if sys.version_info[:2] >= (3, 12):
30 # Python 3.12+ no longer includes setuptools by default.
31
32 # Setuptools 71+ now prefers already installed versions
33 # of packaging _and_ broke the API for packaging<22.0.
34 # We'll pin to match what's in requirements-dev.txt.
35 run("pip install setuptools==71.1.0 packaging==24.1")
36
37 run("pip install -r requirements-dev-lock.txt")