From 3f3effe25d257cd9b9413f33d7330096dbb30d68 Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Mon, 4 May 2020 18:06:47 +0200 Subject: [PATCH] add linux32 to i686 builds (#338) * add linux32 to i686 builds * Add test. Fix bug with space. * Apply suggestions from code review apply suggestions Co-authored-by: Joe Rickerby * change uname to platform.machine Co-authored-by: Joe Rickerby --- cibuildwheel/linux.py | 3 ++- test/02_test/test/spam_test.py | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cibuildwheel/linux.py b/cibuildwheel/linux.py index 6b25055c..d30635c3 100644 --- a/cibuildwheel/linux.py +++ b/cibuildwheel/linux.py @@ -109,6 +109,7 @@ def build(options: BuildOptions): container_name = 'cibuildwheel-{}'.format(uuid.uuid4()) try: + shell_cmd = ['linux32', '/bin/bash'] if platform_tag.endswith("i686") else ['/bin/bash'] call(['docker', 'create', '--env', 'CIBUILDWHEEL', '--name', container_name, @@ -136,7 +137,7 @@ def build(options: BuildOptions): ) call( - ['docker', 'exec', '-i', container_name, '/bin/bash'], + ['docker', 'exec', '-i', container_name] + shell_cmd, universal_newlines=True, input=''' # give xtrace output an extra level of indent inside docker diff --git a/test/02_test/test/spam_test.py b/test/02_test/test/spam_test.py index ba5f5e91..f70bdae8 100644 --- a/test/02_test/test/spam_test.py +++ b/test/02_test/test/spam_test.py @@ -1,6 +1,8 @@ from __future__ import print_function import os +import platform import sys +import struct from unittest import TestCase import spam @@ -43,3 +45,12 @@ class TestSpam(TestCase): print("=[listdir]2", os.listdir(os.path.join(virtualenv_path, 'bin'))) self.assertTrue(path_contains(virtualenv_path, sys.executable)) self.assertTrue(path_contains(virtualenv_path, spam.__file__)) + + def test_uname(self): + if platform.system() == "Windows": + return + # if we're running in 32-bit Python, check that the machine is i686. + # See #336 for more info. + bits = struct.calcsize("P") * 8 + if bits == 32: + self.assertEqual(platform.machine(), "i686")