Skip to content

Commit

Permalink
fix: linux32 call on aarch64 when running armv7l images
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut committed Sep 22, 2024
1 parent f09f6c7 commit 7699f05
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions cibuildwheel/oci_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def __enter__(self) -> Self:
platform_args = self._get_platform_args()

simulate_32_bit = False
if self.oci_platform == OCIPlatform.i386:
if self.oci_platform in {OCIPlatform.i386, OCIPlatform.ARMV7}:
# If the architecture running the image is already the right one
# or the image entrypoint takes care of enforcing this, then we don't need to
# simulate this
Expand All @@ -227,13 +227,14 @@ def __enter__(self) -> Self:
*run_cmd, *platform_args, self.image, *ctr_cmd, capture_stdout=True
).strip()
except subprocess.CalledProcessError:
# The image might have been built with amd64 architecture
# Let's try that
platform_args = self._get_platform_args(oci_platform=OCIPlatform.AMD64)
container_machine = call(
*run_cmd, *platform_args, self.image, *ctr_cmd, capture_stdout=True
).strip()
simulate_32_bit = container_machine != "i686"
if self.oci_platform == OCIPlatform.i386:
# The image might have been built with amd64 architecture
# Let's try that
platform_args = self._get_platform_args(oci_platform=OCIPlatform.AMD64)
container_machine = call(
*run_cmd, *platform_args, self.image, *ctr_cmd, capture_stdout=True
).strip()
simulate_32_bit = container_machine not in {"i686", "armv7l", "armv8l"}

shell_args = ["linux32", "/bin/bash"] if simulate_32_bit else ["/bin/bash"]

Expand Down

0 comments on commit 7699f05

Please sign in to comment.