Skip to content

Commit 117e81c

Browse files
authored
Merge pull request #530 from numpy/astral-sh/setup-uv@v6
2 parents 1ad9343 + 03e27c9 commit 117e81c

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ jobs:
4242
taplo validate --colors never --no-schema
4343
taplo fmt --colors never --check
4444
45-
- uses: astral-sh/setup-uv@v5
46-
with:
47-
enable-cache: true
45+
- uses: astral-sh/setup-uv@v6
4846
- run: uv sync --only-group=list_and_test
4947

5048
- name: ruff
@@ -68,7 +66,7 @@ jobs:
6866
steps:
6967
- uses: actions/checkout@v4
7068

71-
- uses: astral-sh/setup-uv@v5
69+
- uses: astral-sh/setup-uv@v6
7270
with:
7371
enable-cache: true
7472
python-version: ${{ matrix.py }}
@@ -86,9 +84,8 @@ jobs:
8684
steps:
8785
- uses: actions/checkout@v4
8886

89-
- uses: astral-sh/setup-uv@v5
87+
- uses: astral-sh/setup-uv@v6
9088
with:
91-
enable-cache: true
9289
python-version: ${{ matrix.py }}
9390

9491
- name: mypy
@@ -107,12 +104,9 @@ jobs:
107104
steps:
108105
- uses: actions/checkout@v4
109106

110-
- uses: astral-sh/setup-uv@v5
107+
- uses: astral-sh/setup-uv@v6
111108
with:
112-
enable-cache: true
113109
python-version: ${{ matrix.py }}
114110

115111
- name: stubtest
116-
run: >
117-
uv run --no-dev --active -p ${{ matrix.py }}
118-
tool/stubtest.py
112+
run: uv run --active -p ${{ matrix.py }} tool/stubtest.py

tool/stubtest.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,19 @@
3030
CWD = Path.cwd()
3131
TOOL_DIR = Path(__file__).parent
3232
SITE_DIR = Path(sysconfig.get_paths()["purelib"])
33-
ROOT_DIR = TOOL_DIR.parent
34-
3533

36-
ROOT_SITE_DIR = (
37-
ROOT_DIR / ".venv" / "Lib" / "site-packages"
38-
if sys.platform == "win32"
39-
else next((ROOT_DIR / ".venv" / "lib").glob("*/site-packages"))
40-
)
34+
ROOT_DIR = TOOL_DIR.parent
35+
__root_site: Path | None
36+
if (ROOT_DIR / ".venv").is_dir():
37+
__root_venv = ROOT_DIR / ".venv"
38+
__root_site = (
39+
__root_venv / "Lib" / "site-packages"
40+
if sys.platform == "win32"
41+
else next((__root_venv / "lib").glob("*/site-packages"))
42+
)
43+
else:
44+
__root_site = None
45+
ROOT_SITE_DIR = __root_site
4146

4247
ALLOWLISTS = [
4348
"common.txt",
@@ -130,9 +135,10 @@ def _rewrite_mypy_output(line: bytes, /) -> bytes:
130135
if package_lib in line:
131136
line = line.replace(package_lib, package_src)
132137

133-
site_dir = str(SITE_DIR).encode()
134-
if site_dir in line:
135-
line = line.replace(site_dir, str(ROOT_SITE_DIR.relative_to(CWD)).encode())
138+
if ROOT_SITE_DIR is not None:
139+
site_dir = str(SITE_DIR).encode()
140+
if site_dir in line:
141+
line = line.replace(site_dir, str(ROOT_SITE_DIR.relative_to(CWD)).encode())
136142

137143
return line
138144

0 commit comments

Comments
 (0)