Skip to content

Commit 6fe0354

Browse files
authored
Merge pull request #966 from Erotemic/new_podman_support
Podman support on Linux
2 parents 227125c + 5e2d02d commit 6fe0354

25 files changed

+556
-264
lines changed

.github/workflows/test.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ jobs:
4747
with:
4848
python-version: ${{ matrix.python_version }}
4949

50+
# Install podman on this CI instance for podman tests on linux
51+
# Snippet from: https://github.com/redhat-actions/podman-login/blob/main/.github/workflows/example.yml
52+
- name: Install latest podman
53+
if: runner.os == 'Linux'
54+
run: |
55+
. /etc/os-release
56+
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
57+
curl -sSfL "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add -
58+
sudo apt-get update
59+
sudo apt-get -y upgrade
60+
sudo apt-get -y install podman
61+
5062
- name: Install dependencies
5163
run: |
5264
python -m pip install ".[test]"
@@ -70,7 +82,7 @@ jobs:
7082

7183
- name: Test cibuildwheel
7284
run: |
73-
python ./bin/run_tests.py
85+
python ./bin/run_tests.py --run-podman
7486
7587
test-emulated:
7688
name: Test emulated cibuildwheel using qemu

.pre-commit-config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ repos:
6161
- pygithub
6262
- rich
6363
- tomli
64+
- tomli_w
6465
- types-certifi
6566
- types-click
6667
- types-dataclasses

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ Options
130130
| | [`CIBW_BEFORE_BUILD`](https://cibuildwheel.readthedocs.io/en/stable/options/#before-build) | Execute a shell command preparing each wheel's build |
131131
| | [`CIBW_REPAIR_WHEEL_COMMAND`](https://cibuildwheel.readthedocs.io/en/stable/options/#repair-wheel-command) | Execute a shell command to repair each built wheel |
132132
| | [`CIBW_MANYLINUX_*_IMAGE`<br/>`CIBW_MUSLLINUX_*_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#linux-image) | Specify alternative manylinux / musllinux Docker images |
133+
| | [`CIBW_CONTAINER_ENGINE`](https://cibuildwheel.readthedocs.io/en/stable/options/#container-engine) | Specify which container engine to use when building Linux wheels |
133134
| | [`CIBW_DEPENDENCY_VERSIONS`](https://cibuildwheel.readthedocs.io/en/stable/options/#dependency-versions) | Specify how cibuildwheel controls the versions of the tools it uses |
134135
| **Testing** | [`CIBW_TEST_COMMAND`](https://cibuildwheel.readthedocs.io/en/stable/options/#test-command) | Execute a shell command to test each built wheel |
135136
| | [`CIBW_BEFORE_TEST`](https://cibuildwheel.readthedocs.io/en/stable/options/#before-test) | Execute a shell command before testing each wheel |

bin/run_tests.py

+31-17
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,47 @@
11
#!/usr/bin/env python3
22

3+
import argparse
34
import os
45
import subprocess
56
import sys
67
from pathlib import Path
78

89
if __name__ == "__main__":
10+
parser = argparse.ArgumentParser()
11+
parser.add_argument(
12+
"--run-podman", action="store_true", default=False, help="run podman tests (linux only)"
13+
)
14+
args = parser.parse_args()
15+
916
# move cwd to the project root
1017
os.chdir(Path(__file__).resolve().parents[1])
1118

12-
# run the unit tests
19+
# unit tests
1320
unit_test_args = [sys.executable, "-m", "pytest", "unit_test"]
14-
# run the docker unit tests only on Linux
21+
1522
if sys.platform.startswith("linux"):
23+
# run the docker unit tests only on Linux
1624
unit_test_args += ["--run-docker"]
25+
26+
if args.run_podman:
27+
unit_test_args += ["--run-podman"]
28+
1729
subprocess.run(unit_test_args, check=True)
1830

19-
# run the integration tests
20-
subprocess.run(
21-
[
22-
sys.executable,
23-
"-m",
24-
"pytest",
25-
"--numprocesses=2",
26-
"-x",
27-
"--durations",
28-
"0",
29-
"--timeout=2400",
30-
"test",
31-
],
32-
check=True,
33-
)
31+
# integration tests
32+
integration_test_args = [
33+
sys.executable,
34+
"-m",
35+
"pytest",
36+
"--numprocesses=2",
37+
"-x",
38+
"--durations",
39+
"0",
40+
"--timeout=2400",
41+
"test",
42+
]
43+
44+
if sys.platform.startswith("linux") and args.run_podman:
45+
integration_test_args += ["--run-podman"]
46+
47+
subprocess.run(integration_test_args, check=True)

cibuildwheel/__main__.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def main() -> None:
4646
auto-detected platform or to run cibuildwheel on your development
4747
machine. Specifying "macos" or "windows" only works on that
4848
operating system, but "linux" works on all three, as long as
49-
Docker is installed. Default: auto.
49+
Docker/Podman is installed. Default: auto.
5050
""",
5151
)
5252

@@ -91,7 +91,7 @@ def main() -> None:
9191
Path to the package that you want wheels for. Default: the working
9292
directory. Can be a directory inside the working directory, or an
9393
sdist. When set to a directory, the working directory is still
94-
considered the 'project' and is copied into the Docker container
94+
considered the 'project' and is copied into the build container
9595
on Linux. When set to a tar.gz sdist file, --config-file
9696
and --output-dir are relative to the current directory, and other
9797
paths are relative to the expanded SDist directory.
@@ -208,7 +208,6 @@ def build_in_directory(args: CommandLineArguments) -> None:
208208
sys.exit(0)
209209

210210
# Add CIBUILDWHEEL environment variable
211-
# This needs to be passed on to the docker container in linux.py
212211
os.environ["CIBUILDWHEEL"] = "1"
213212

214213
# Python is buffering by default when running on the CI platforms, giving problems interleaving subprocess call output with unflushed calls to 'print'

cibuildwheel/architecture.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def auto_archs(platform: PlatformName) -> "Set[Architecture]":
5959
result = {native_architecture}
6060

6161
if platform == "linux" and native_architecture == Architecture.x86_64:
62-
# x86_64 machines can run i686 docker containers
62+
# x86_64 machines can run i686 containers
6363
result.add(Architecture.i686)
6464

6565
if platform == "windows" and native_architecture == Architecture.AMD64:

0 commit comments

Comments
 (0)