File: venv

package info (click to toggle)
python-noseofyeti 2.4.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 360 kB
  • sloc: python: 2,581; sh: 31; makefile: 12
file content (52 lines) | stat: -rwxr-xr-x 1,470 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python3

from pathlib import Path
import typing as tp
import subprocess
import shutil
import runpy
import glob
import sys
import os

here = Path(__file__).parent
manager = runpy.run_path(str(Path(__file__).parent / "bootstrap_venvstarter.py"))["manager"]


def run(venv_location: Path, args: tp.List[str]) -> tp.Union[None, str, tp.List[str]]:
    os.environ["NOSE_OF_YETI_BLACK_COMPAT"] = "true"

    for dr in Path(venv_location / "lib").iterdir():
        if dr.name.startswith("python"):
            pth_file = dr / "site-packages" / "noy_black.pth"
            if not pth_file.exists():
                pth_file.symlink_to(here / ".." / "noseOfYeti" / "black" / "noy_black.pth")
            break

    devtools_location = Path(__file__).parent / "devtools.py"
    return ["python", str(devtools_location)]


manager = manager(run).named(".python")
manager.add_no_binary("black")
manager.add_env(NOSE_OF_YETI_BLACK_COMPAT="true")
manager.add_local_dep(
    "{here}",
    "..",
    version_file=(
        "noseOfYeti",
        "version.py",
    ),
    name="noseOfYeti[black,tests]=={version}",
)

if "TOX_PYTHON" in os.environ:
    folder = Path(os.environ["TOX_PYTHON"]).parent.parent
    manager.place_venv_in(folder.parent)
    manager.named(folder.name)
else:
    manager.add_no_binary("black")
    manager.add_requirements_file("{here}", "requirements.dev.txt")
    manager.add_requirements_file("{here}", "requirements.docs.txt")

manager.run()