File: install

package info (click to toggle)
python-boto3 1.26.27%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,880 kB
  • sloc: python: 12,629; makefile: 128
file content (35 lines) | stat: -rwxr-xr-x 856 bytes parent folder | download
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
#!/usr/bin/env python
import os
import shutil
from contextlib import contextmanager
from subprocess import check_call

_dname = os.path.dirname

REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__))))


@contextmanager
def cd(path):
    """Change directory while inside context manager."""
    cwd = os.getcwd()
    try:
        os.chdir(path)
        yield
    finally:
        os.chdir(cwd)


def run(command):
    return check_call(command, shell=True)


if __name__ == "__main__":
    with cd(REPO_ROOT):
        run("pip install -r requirements.txt")
        run("python scripts/ci/install-dev-deps")
        if os.path.isdir("dist") and os.listdir("dist"):
            shutil.rmtree("dist")
        run("python setup.py bdist_wheel")
        wheel_dist = os.listdir("dist")[0]
        run("pip install %s" % (os.path.join("dist", wheel_dist)))