fix: do not use linux32 when unnecessary

This commit is contained in:
mayeut
2023-09-18 21:28:32 +02:00
parent a873dd9cbf
commit 1646b08659
+11 -2
View File
@@ -17,7 +17,7 @@ from types import TracebackType
from typing import IO, Dict, Literal
from .typing import PathOrStr, PopenBytes
from .util import CIProvider, detect_ci_provider, parse_key_value_string
from .util import CIProvider, call, detect_ci_provider, parse_key_value_string
ContainerEngineName = Literal["docker", "podman"]
@@ -110,7 +110,16 @@ class OCIContainer:
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"]
simulate_32_bit = self.simulate_32_bit
container_machine = call(
self.engine.name, "run", "--rm", self.image, "uname", "-m", capture_stdout=True
).strip()
if container_machine not in {"x86_64", "aarch64"}:
# either the architecture running the image is already the right one
# or the image entrypoint took care of this
simulate_32_bit = False
shell_args = ["linux32", "/bin/bash"] if simulate_32_bit else ["/bin/bash"]
subprocess.run(
[