14
14
15
15
ENCODING = 'utf-8'
16
16
MANYLINUX1_IMAGE_ID = 'quay.io/pypa/manylinux1_x86_64'
17
- #TODO: use the pypa manylinux2010 image on release
18
- MANYLINUX2010_IMAGE_ID = 'zombiefeynman/manylinux2010_x86_64'
17
+ MANYLINUX2010_IMAGE_ID = 'quay.io/pypa/manylinux2010_x86_64'
19
18
MANYLINUX_IMAGES = {
20
19
'manylinux1' : MANYLINUX1_IMAGE_ID ,
21
20
'manylinux2010' : MANYLINUX2010_IMAGE_ID ,
22
21
}
23
22
DOCKER_CONTAINER_NAME = 'auditwheel-test-manylinux'
24
23
PYTHON_IMAGE_ID = 'python:3.5'
25
- PATH = ('/opt/python/cp35-cp35m/bin:/opt/rh/devtoolset-2/root/usr/bin:'
26
- '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' )
24
+ DEVTOOLSET = {
25
+ 'manylinux1' : 'devtoolset-2' ,
26
+ 'manylinux2010' : 'devtoolset-8' ,
27
+ }
28
+ PATH_DIRS = [
29
+ '/opt/python/cp35-cp35m/bin' ,
30
+ '/opt/rh/{devtoolset}/root/usr/bin' ,
31
+ '/usr/local/sbin' ,
32
+ '/usr/local/bin' ,
33
+ '/usr/sbin' ,
34
+ '/usr/bin' ,
35
+ '/sbin' ,
36
+ '/bin' ,
37
+ ]
38
+ PATH = {k : ':' .join (PATH_DIRS ).format (devtoolset = v )
39
+ for k , v in DEVTOOLSET .items ()}
27
40
WHEEL_CACHE_FOLDER = op .expanduser ('~/.cache/auditwheel_tests' )
28
41
ORIGINAL_NUMPY_WHEEL = 'numpy-1.11.0-cp35-cp35m-linux_x86_64.whl'
29
42
ORIGINAL_SIX_WHEEL = 'six-1.11.0-py2.py3-none-any.whl'
@@ -71,14 +84,16 @@ def docker_exec(container_id, cmd):
71
84
def docker_container (request ):
72
85
if find_executable ("docker" ) is None :
73
86
pytest .skip ('docker is required' )
74
- if not op .exists (WHEEL_CACHE_FOLDER ):
75
- os .makedirs (WHEEL_CACHE_FOLDER )
87
+
88
+ policy = request .param
89
+ if not op .exists (op .join (WHEEL_CACHE_FOLDER , policy )):
90
+ os .makedirs (op .join (WHEEL_CACHE_FOLDER , policy ))
76
91
src_folder = find_src_folder ()
77
92
if src_folder is None :
78
93
pytest .skip ('Can only be run from the source folder' )
79
94
io_folder = tempfile .mkdtemp (prefix = 'tmp_auditwheel_test_manylinux_' ,
80
95
dir = src_folder )
81
- policy = request . param
96
+
82
97
manylinux_id , python_id = None , None
83
98
try :
84
99
# Launch a docker container with volumes and pre-configured Python
@@ -89,7 +104,7 @@ def docker_container(request):
89
104
manylinux_id = docker_start (
90
105
MANYLINUX_IMAGES [policy ],
91
106
volumes = {'/io' : io_folder , '/auditwheel_src' : src_folder },
92
- env_variables = {'PATH' : PATH })
107
+ env_variables = {'PATH' : PATH [ policy ] })
93
108
# Install the development version of auditwheel from source:
94
109
docker_exec (manylinux_id , 'pip install -U pip setuptools' )
95
110
docker_exec (manylinux_id , 'pip install -U /auditwheel_src' )
@@ -121,9 +136,9 @@ def test_build_repair_numpy(docker_container):
121
136
policy , manylinux_id , python_id , io_folder = docker_container
122
137
docker_exec (manylinux_id , 'yum install -y atlas atlas-devel' )
123
138
124
- if op .exists (op .join (WHEEL_CACHE_FOLDER , ORIGINAL_NUMPY_WHEEL )):
139
+ if op .exists (op .join (WHEEL_CACHE_FOLDER , policy , ORIGINAL_NUMPY_WHEEL )):
125
140
# If numpy has already been built and put in cache, let's reuse this.
126
- shutil .copy2 (op .join (WHEEL_CACHE_FOLDER , ORIGINAL_NUMPY_WHEEL ),
141
+ shutil .copy2 (op .join (WHEEL_CACHE_FOLDER , policy , ORIGINAL_NUMPY_WHEEL ),
127
142
op .join (io_folder , ORIGINAL_NUMPY_WHEEL ))
128
143
else :
129
144
# otherwise build the original linux_x86_64 numpy wheel from source
@@ -133,7 +148,7 @@ def test_build_repair_numpy(docker_container):
133
148
docker_exec (manylinux_id ,
134
149
'pip wheel -w /io --no-binary=:all: numpy==1.11.0' )
135
150
shutil .copy2 (op .join (io_folder , ORIGINAL_NUMPY_WHEEL ),
136
- op .join (WHEEL_CACHE_FOLDER , ORIGINAL_NUMPY_WHEEL ))
151
+ op .join (WHEEL_CACHE_FOLDER , policy , ORIGINAL_NUMPY_WHEEL ))
137
152
filenames = os .listdir (io_folder )
138
153
assert filenames == [ORIGINAL_NUMPY_WHEEL ]
139
154
orig_wheel = filenames [0 ]
@@ -146,21 +161,15 @@ def test_build_repair_numpy(docker_container):
146
161
docker_exec (manylinux_id , repair_command )
147
162
filenames = os .listdir (io_folder )
148
163
149
- if policy == 'manylinux1' :
150
- expected_files = 2
151
- elif policy == 'manylinux2010' :
152
- expected_files = 3 # We end up repairing the wheel twice to manylinux1
153
-
154
- assert len (filenames ) == expected_files
155
- # Regardless of build environment, wheel only needs manylinux1 symbols
156
- repaired_wheels = [fn for fn in filenames if 'manylinux1' in fn ]
157
- assert repaired_wheels == ['numpy-1.11.0-cp35-cp35m-manylinux1_x86_64.whl' ]
164
+ assert len (filenames ) == 2
165
+ repaired_wheels = [fn for fn in filenames if 'manylinux' in fn ]
166
+ assert repaired_wheels == ['numpy-1.11.0-cp35-cp35m-{}_x86_64.whl' .format (policy )]
158
167
repaired_wheel = repaired_wheels [0 ]
159
168
output = docker_exec (manylinux_id , 'auditwheel show /io/' + repaired_wheel )
160
169
assert (
161
- 'numpy-1.11.0-cp35-cp35m-manylinux1_x86_64 .whl is consistent'
162
- ' with the following platform tag: "manylinux1_x86_64 "'
163
- ) in output .replace ('\n ' , ' ' )
170
+ 'numpy-1.11.0-cp35-cp35m-{policy}_x86_64 .whl is consistent'
171
+ ' with the following platform tag: "{policy}_x86_64 "'
172
+ ). format ( policy = policy ) in output .replace ('\n ' , ' ' )
164
173
165
174
# Check that the repaired numpy wheel can be installed and executed
166
175
# on a modern linux image.
@@ -211,12 +220,6 @@ def test_build_wheel_with_binary_executable(docker_container):
211
220
' with the following platform tag: "{policy}_x86_64"'
212
221
).format (policy = policy ) in output .replace ('\n ' , ' ' )
213
222
214
- # TODO: Remove once pip supports manylinux2010
215
- docker_exec (
216
- python_id ,
217
- "pip install git+https://github.com/wtolson/pip.git@manylinux2010" ,
218
- )
219
-
220
223
docker_exec (python_id , 'pip install /io/' + repaired_wheel )
221
224
output = docker_exec (
222
225
python_id , ['python' , '-c' , 'from testpackage import runit; print(runit(1.5))' ]).strip ()
@@ -226,15 +229,15 @@ def test_build_wheel_with_binary_executable(docker_container):
226
229
def test_build_repair_pure_wheel (docker_container ):
227
230
policy , manylinux_id , python_id , io_folder = docker_container
228
231
229
- if op .exists (op .join (WHEEL_CACHE_FOLDER , ORIGINAL_SIX_WHEEL )):
232
+ if op .exists (op .join (WHEEL_CACHE_FOLDER , policy , ORIGINAL_SIX_WHEEL )):
230
233
# If six has already been built and put in cache, let's reuse this.
231
- shutil .copy2 (op .join (WHEEL_CACHE_FOLDER , ORIGINAL_SIX_WHEEL ),
234
+ shutil .copy2 (op .join (WHEEL_CACHE_FOLDER , policy , ORIGINAL_SIX_WHEEL ),
232
235
op .join (io_folder , ORIGINAL_SIX_WHEEL ))
233
236
else :
234
237
docker_exec (manylinux_id ,
235
238
'pip wheel -w /io --no-binary=:all: six==1.11.0' )
236
239
shutil .copy2 (op .join (io_folder , ORIGINAL_SIX_WHEEL ),
237
- op .join (WHEEL_CACHE_FOLDER , ORIGINAL_SIX_WHEEL ))
240
+ op .join (WHEEL_CACHE_FOLDER , policy , ORIGINAL_SIX_WHEEL ))
238
241
239
242
filenames = os .listdir (io_folder )
240
243
assert filenames == [ORIGINAL_SIX_WHEEL ]
0 commit comments