From 65c7a69af83e4bfd21f713ec9117863b6fdc3acd Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 6 Jan 2022 08:55:49 +0100 Subject: [PATCH] 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 --- cibuildwheel/docker_container.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cibuildwheel/docker_container.py b/cibuildwheel/docker_container.py index 51aa2a83..a145072e 100644 --- a/cibuildwheel/docker_container.py +++ b/cibuildwheel/docker_container.py @@ -1,6 +1,7 @@ import io import json import os +import platform import shlex import subprocess import sys @@ -9,6 +10,8 @@ from pathlib import Path, PurePath from types import TracebackType from typing import IO, Dict, List, Optional, Sequence, Type, cast +from cibuildwheel.util import CIProvider, detect_ci_provider + from .typing import PathOrStr, PopenBytes @@ -44,6 +47,15 @@ class DockerContainer: def __enter__(self) -> "DockerContainer": self.name = f"cibuildwheel-{uuid.uuid4()}" cwd_args = ["-w", str(self.cwd)] if self.cwd else [] + + # work-around for Travis-CI PPC64le Docker runs since 2021: + # this avoids network splits + # https://github.com/pypa/cibuildwheel/issues/904 + # https://github.com/conda-forge/conda-smithy/pull/1520 + network_args = [] + if detect_ci_provider() == CIProvider.travis_ci and platform.machine() == "ppc64le": + network_args = ["--network=host"] + shell_args = ["linux32", "/bin/bash"] if self.simulate_32_bit else ["/bin/bash"] subprocess.run( [ @@ -53,6 +65,7 @@ class DockerContainer: f"--name={self.name}", "--interactive", "--volume=/:/host", # ignored on CircleCI + *network_args, *cwd_args, self.docker_image, *shell_args,