Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: "3.12"
python-version: "3.13"
- uses: astral-sh/setup-uv@v7
- name: Install nox
run: uv tool install nox
Expand Down Expand Up @@ -94,10 +94,9 @@ jobs:
- python-version: "3.12"
runs-on: windows-latest
cmake-version: "3.26.x"
# TODO: CMake doesn't work with beta 1 on Windows
# - python-version: "3.14"
# runs-on: windows-latest
# cmake-version: "4.0.x"
- python-version: "3.14"
runs-on: windows-latest
cmake-version: "4.0.x"
- python-version: "3.13"
runs-on: windows-latest
cmake-version: "3.26.x"
Expand All @@ -120,9 +119,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
# Python 3.13.4 broken on Windows
check-latest: >-
${{ matrix.python-version == '3.13' && runner.os == 'Windows' }}

- uses: astral-sh/setup-uv@v7

Expand Down
4 changes: 4 additions & 0 deletions tests/test_cmake_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ def test_get_cmake_via_envvar(monkeypatch: pytest.MonkeyPatch, fp):
fp.register(
[cmake_path, "-E", "capabilities"], stdout='{"version":{"string":"3.20.0"}}'
)
fp.register(
["lipo", "-info", "some-prog"],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
monkeypatch.setenv("CMAKE_EXECUTABLE", str(cmake_path))
result = CMake.default_search(env=os.environ)
assert result.cmake_path == cmake_path
Expand Down
44 changes: 44 additions & 0 deletions tests/test_get_requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def test_get_requires_parts(fp: FakeProcess):
[Path("cmake/path"), "-E", "capabilities"],
stdout='{"version":{"string":"3.14.0"}}',
)
fp.register(
["lipo", "-info", "cmake/path"],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
assert set(GetRequires().cmake()) == {"cmake>=3.15"}
assert set(GetRequires().ninja()) == {*ninja}

Expand All @@ -40,6 +44,10 @@ def test_get_requires_parts_uneeded(fp: FakeProcess):
[Path("cmake/path"), "-E", "capabilities"],
stdout='{"version":{"string":"3.18.0"}}',
)
fp.register(
["lipo", "-info", "cmake/path"],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
assert set(GetRequires().cmake()) == set()
assert set(GetRequires().ninja()) == {*ninja}

Expand All @@ -49,6 +57,10 @@ def test_get_requires_parts_settings(fp: FakeProcess):
[Path("cmake/path"), "-E", "capabilities"],
stdout='{"version":{"string":"3.18.0"}}',
)
fp.register(
["lipo", "-info", "cmake/path"],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
config = {"cmake.version": ">=3.20"}
assert set(GetRequires.from_config_settings(config).cmake()) == {"cmake>=3.20"}
assert set(GetRequires.from_config_settings(config).ninja()) == {*ninja}
Expand All @@ -68,6 +80,10 @@ def test_get_requires_parts_pyproject(
[Path("cmake/path"), "-E", "capabilities"],
stdout='{"version":{"string":"3.18.0"}}',
)
fp.register(
["lipo", "-info", "cmake/path"],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)

assert set(GetRequires().cmake()) == {"cmake>=3.21"}
assert set(GetRequires().ninja()) == {*ninja}
Expand All @@ -89,6 +105,10 @@ def test_get_requires_parts_pyproject_old(
[Path("cmake/path"), "-E", "capabilities"],
stdout='{"version":{"string":"3.18.0"}}',
)
fp.register(
["lipo", "-info", "cmake/path"],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)

assert set(GetRequires().cmake()) == {"cmake>=3.21"}
assert set(GetRequires().ninja()) == {*ninja}
Expand All @@ -99,6 +119,10 @@ def test_get_requires_for_build_sdist(fp: FakeProcess):
[Path("cmake/path"), "-E", "capabilities"],
stdout='{"version":{"string":"3.14.0"}}',
)
fp.register(
["lipo", "-info", "cmake/path"],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
assert set(get_requires_for_build_sdist({})) == set()


Expand All @@ -108,6 +132,10 @@ def test_get_requires_for_build_sdist_cmake(fp: FakeProcess):
[Path("cmake/path"), "-E", "capabilities"],
stdout='{"version":{"string":"3.14.0"}}',
)
fp.register(
["lipo", "-info", "cmake/path"],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
assert set(get_requires_for_build_sdist({"sdist.cmake": "True"})) == expected


Expand All @@ -117,6 +145,10 @@ def test_get_requires_for_build_wheel(fp: FakeProcess):
[Path("cmake/path"), "-E", "capabilities"],
stdout='{"version":{"string":"3.14.0"}}',
)
fp.register(
["lipo", "-info", "cmake/path"],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
assert set(get_requires_for_build_wheel({})) == expected


Expand All @@ -125,6 +157,10 @@ def test_get_requires_for_build_wheel_pure(fp: FakeProcess):
[Path("cmake/path"), "-E", "capabilities"],
stdout='{"version":{"string":"3.14.0"}}',
)
fp.register(
["lipo", "-info", "cmake/path"],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
assert set(get_requires_for_build_wheel({"wheel.cmake": "False"})) == set()


Expand All @@ -134,6 +170,10 @@ def test_get_requires_for_build_editable(fp: FakeProcess):
[Path("cmake/path"), "-E", "capabilities"],
stdout='{"version":{"string":"3.14.0"}}',
)
fp.register(
["lipo", "-info", "cmake/path"],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
assert set(get_requires_for_build_editable({})) == expected


Expand All @@ -142,4 +182,8 @@ def test_get_requires_for_build_editable_pure(fp: FakeProcess):
[Path("cmake/path"), "-E", "capabilities"],
stdout='{"version":{"string":"3.14.0"}}',
)
fp.register(
["lipo", "-info", "cmake/path"],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
assert set(get_requires_for_build_editable({"wheel.cmake": "False"})) == set()
24 changes: 24 additions & 0 deletions tests/test_program_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ def test_get_cmake_programs_all(monkeypatch, fp):
[cmake3_path, "-E", "capabilities"],
stdout='{"version":{"string":"3.19.0"}}',
)
fp.register(
["lipo", "-info", cmake_path],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
fp.register(
["lipo", "-info", cmake3_path],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
programs = list(get_cmake_programs(module=False))
assert len(programs) == 2
assert programs[0].path.name == "cmake3"
Expand All @@ -71,6 +79,14 @@ def test_get_ninja_programs_all(monkeypatch, fp):
ninja_build_path = Path("ninja-build")
fp.register([ninja_path, "--version"], stdout="1.10.1.git.kitware.jobserver-1")
fp.register([ninja_build_path, "--version"], stdout="1.8.2")
fp.register(
["lipo", "-info", ninja_path],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
fp.register(
["lipo", "-info", ninja_build_path],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
programs = list(get_ninja_programs(module=False))
assert len(programs) == 2
assert programs[0].path.name == "ninja-build"
Expand All @@ -94,6 +110,14 @@ def test_get_cmake_programs_malformed(monkeypatch, fp, caplog):
cmake3_path = Path("cmake3")
fp.register([cmake_path, "-E", "capabilities"], stdout="scrambled output\n")
fp.register([cmake3_path, "-E", "capabilities"], stdout="{}")
fp.register(
["lipo", "-info", cmake_path],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
fp.register(
["lipo", "-info", cmake3_path],
stdout="Architectures in the fat file: ... are: x86_64 arm64",
)
programs = list(get_cmake_programs(module=False))
assert caplog.records
assert "Could not determine CMake version" in str(caplog.records[0].msg)
Expand Down
Loading