Skip to content

Commit f67aa5f

Browse files
committed
Disable build isolation
1 parent 5bea94c commit f67aa5f

File tree

3 files changed

+55
-29
lines changed

3 files changed

+55
-29
lines changed

.github/workflows/dissect-ci.yml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ jobs:
1616
run-benchmarks: true
1717

1818
build-native:
19-
name: Build native wheels on ${{ matrix.os }}
2019
runs-on: ${{ matrix.os }}
2120
strategy:
2221
matrix:
@@ -32,37 +31,35 @@ jobs:
3231
- run: curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
3332

3433
- uses: actions/setup-python@v5
34+
with:
35+
python-version: "3.12"
3536

3637
- run: python -m pip install cibuildwheel==2.23.2
3738

3839
- run: python -m cibuildwheel --output-dir dist
3940
env:
4041
CIBW_ARCHS_LINUX: ${{ runner.arch == 'X64' && 'auto ppc64le s390x' || 'auto armv7l' }}
4142
CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y
42-
CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc
43+
CIBW_BEFORE_ALL_WINDOWS: ${{ runner.arch == 'X64' && 'rustup target add i686-pc-windows-msvc' || '' }}
4344
# Manually install setuptools-rust to enable building native wheels
4445
CIBW_BEFORE_BUILD: >
45-
python -m pip install -U setuptools-rust
46-
CIBW_BUILD_FRONTEND: build
47-
CIBW_ENVIRONMENT: PATH="$HOME/.cargo/bin:$PATH"
48-
CIBW_ENVIRONMENT_WINDOWS: PATH="$UserProfile\.cargo\bin;$PATH"
49-
# Use abi3audit to catch issues with Limited API wheels
50-
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
51-
auditwheel repair -w {dest_dir} {wheel} &&
52-
pipx run abi3audit --strict --report {wheel}
53-
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
54-
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} &&
55-
pipx run abi3audit --strict --report {wheel}
56-
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
57-
copy {wheel} {dest_dir} &&
58-
pipx run abi3audit --strict --report {wheel}
46+
python -m pip install -U setuptools>=77.0.0 setuptools_scm[toml]>=6.4.0 setuptools-rust
47+
CIBW_BUILD_FRONTEND: "build; args: --no-isolation"
48+
CIBW_CONFIG_SETTINGS: "--build-option=--py-limited-api=cp39"
49+
CIBW_ENABLE: pypy
50+
CIBW_ENVIRONMENT_LINUX: 'PATH="$HOME/.cargo/bin:$PATH"'
51+
CIBW_ENVIRONMENT_MACOS: 'MACOSX_DEPLOYMENT_TARGET=10.12'
52+
CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"'
53+
CIBW_SKIP: '*-musllinux_i686'
5954
# Run tests
6055
CIBW_TEST_REQUIRES: tox
61-
CIBW_TEST_COMMAND: tox -c {package}/tox.ini --installpkg {wheel}
56+
CIBW_TEST_COMMAND: tox -e native -c {package}/tox.ini --installpkg {wheel}
57+
58+
- run: pip install abi3audit && abi3audit --strict --report dist/*-abi3-*.whl
6259

6360
- uses: actions/upload-artifact@v4
6461
with:
65-
name: packages
62+
name: packages-native-${{ matrix.os }}
6663
path: dist/*
6764
retention-days: 1
6865

@@ -76,7 +73,7 @@ jobs:
7673
steps:
7774
- uses: actions/download-artifact@v4
7875
with:
79-
name: packages
76+
pattern: packages-*
8077
path: dist/
8178
# According to the documentation, it automatically looks inside the `dist/` folder for packages.
8279
- name: Publish package distributions to Pypi

tests/conftest.py

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,40 @@
33
import pytest
44

55

6+
def pytest_addoption(parser: pytest.Parser) -> None:
7+
parser.addoption(
8+
"--force-native", action="store_true", default=False, help="run native tests, not allowing fallbacks"
9+
)
10+
11+
612
@pytest.fixture(scope="session", params=[True, False], ids=["native", "python"])
7-
def lz4(request: pytest.FixtureRequest) -> ModuleType:
13+
def _native(request: pytest.FixtureRequest, pytestconfig: pytest.Config) -> ModuleType:
814
if request.param:
9-
return pytest.importorskip("dissect.util._native", reason="_native module is unavailable").compression.lz4
15+
try:
16+
import dissect.util._native
17+
except ImportError:
18+
(pytest.fail if pytestconfig.getoption("--force-native") else pytest.skip)("_native module is unavailable")
19+
else:
20+
return dissect.util._native
1021

11-
return pytest.importorskip("dissect.util.compression.lz4")
22+
return None
1223

1324

14-
@pytest.fixture(scope="session", params=[True, False], ids=["native", "python"])
15-
def lzo(request: pytest.FixtureRequest) -> ModuleType:
16-
if request.param:
17-
return pytest.importorskip("dissect.util._native", reason="_native module is unavailable").compression.lzo
25+
@pytest.fixture(scope="session")
26+
def lz4(_native: ModuleType) -> ModuleType:
27+
if _native:
28+
return _native.compression.lz4
29+
30+
import dissect.util.compression.lz4
31+
32+
return dissect.util.compression.lz4
33+
34+
35+
@pytest.fixture(scope="session")
36+
def lzo(_native: ModuleType) -> ModuleType:
37+
if _native:
38+
return _native.compression.lzo
39+
40+
import dissect.util.compression.lzo
1841

19-
return pytest.importorskip("dissect.util.compression.lzo")
42+
return dissect.util.compression.lzo

tox.ini

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ deps =
1717
config_settings_build_wheel = --build-option=--py-limited-api=cp39
1818

1919
[testenv]
20-
package = wheel
2120
deps =
2221
pytest
2322
pytest-cov
@@ -27,6 +26,13 @@ commands =
2726
coverage report
2827
coverage xml
2928

29+
[testenv:native]
30+
package = wheel
31+
deps =
32+
pytest
33+
commands =
34+
pytest --basetemp="{envtmpdir}" --import-mode="append" --force-native {posargs:--color=yes -v tests}
35+
3036
[testenv:benchmark]
3137
deps =
3238
pytest
@@ -35,7 +41,7 @@ deps =
3541
passenv =
3642
CODSPEED_ENV
3743
commands =
38-
pytest --basetemp="{envtmpdir}" {posargs:--color=yes -v tests}
44+
pytest --basetemp="{envtmpdir}" --import-mode="append" {posargs:--color=yes -v tests}
3945

4046
[testenv:build]
4147
package = skip

0 commit comments

Comments
 (0)