Skip to content

Commit 65c7a69

Browse files
ax3lpre-commit-ci[bot]mayeut
authored
Travis-CI: Fix Container Network (#906)
* Travis-CI: Fix Container Network Add `--network=host` to Travis-CI PPC64le runners. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Travis PPC64le: Move Docker Work-Around Move the control of the work-around for docker on ppc64le on travis into the `docker_container` logic and do not expose as interface. * style: minor fix Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: mayeut <[email protected]>
1 parent 9e18cb8 commit 65c7a69

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cibuildwheel/docker_container.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import io
22
import json
33
import os
4+
import platform
45
import shlex
56
import subprocess
67
import sys
@@ -9,6 +10,8 @@
910
from types import TracebackType
1011
from typing import IO, Dict, List, Optional, Sequence, Type, cast
1112

13+
from cibuildwheel.util import CIProvider, detect_ci_provider
14+
1215
from .typing import PathOrStr, PopenBytes
1316

1417

@@ -44,6 +47,15 @@ def __init__(
4447
def __enter__(self) -> "DockerContainer":
4548
self.name = f"cibuildwheel-{uuid.uuid4()}"
4649
cwd_args = ["-w", str(self.cwd)] if self.cwd else []
50+
51+
# work-around for Travis-CI PPC64le Docker runs since 2021:
52+
# this avoids network splits
53+
# https://github.com/pypa/cibuildwheel/issues/904
54+
# https://github.com/conda-forge/conda-smithy/pull/1520
55+
network_args = []
56+
if detect_ci_provider() == CIProvider.travis_ci and platform.machine() == "ppc64le":
57+
network_args = ["--network=host"]
58+
4759
shell_args = ["linux32", "/bin/bash"] if self.simulate_32_bit else ["/bin/bash"]
4860
subprocess.run(
4961
[
@@ -53,6 +65,7 @@ def __enter__(self) -> "DockerContainer":
5365
f"--name={self.name}",
5466
"--interactive",
5567
"--volume=/:/host", # ignored on CircleCI
68+
*network_args,
5669
*cwd_args,
5770
self.docker_image,
5871
*shell_args,

0 commit comments

Comments
 (0)