1
1
from __future__ import print_function
2
- import os , subprocess , shlex , sys
2
+ import os , subprocess , shlex , sys , re
3
3
from collections import namedtuple
4
4
from glob import glob
5
5
try :
8
8
from pipes import quote as shlex_quote
9
9
10
10
from .util import prepare_command
11
+ from .filter_wheels import is_supported
11
12
12
13
13
14
def build (project_dir , package_name , output_dir , test_command , test_requires , before_build , skip ):
@@ -22,7 +23,7 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be
22
23
def shell (args , env = None , cwd = None ):
23
24
# print the command executing for the logs
24
25
print ('+ ' + ' ' .join (shlex_quote (a ) for a in args ))
25
- return subprocess .check_call (args , env = env , cwd = cwd )
26
+ return subprocess .check_output (args , env = env , cwd = cwd )
26
27
27
28
for config in python_configurations :
28
29
if skip (config .identifier ):
@@ -61,19 +62,25 @@ def shell(args, env=None, cwd=None):
61
62
# build the wheel to temp dir
62
63
temp_wheel_dir = '/tmp/tmpwheel%s' % config .version
63
64
shell ([pip , 'wheel' , project_dir , '-w' , temp_wheel_dir , '--no-deps' ], env = env )
64
- temp_wheel = glob (temp_wheel_dir + '/*.whl' )[0 ]
65
65
66
- if temp_wheel .endswith ('none-any.whl' ):
67
- # pure python wheel - just copy to output_dir
68
- shell (['cp' , temp_wheel , output_dir ], env = env )
69
- else :
70
- # list the dependencies
71
- shell (['delocate-listdeps' , temp_wheel ], env = env )
72
- # rebuild the wheel with shared libraries included and place in output dir
73
- shell (['delocate-wheel' , '-w' , output_dir , temp_wheel ], env = env )
66
+ for temp_wheel in glob (temp_wheel_dir + '/*.whl' ):
67
+ if temp_wheel .endswith ('none-any.whl' ):
68
+ # pure python wheel - just copy to output_dir
69
+ shell (['cp' , temp_wheel , output_dir ], env = env )
70
+ else :
71
+ # list the dependencies
72
+ shell (['delocate-listdeps' , temp_wheel ], env = env )
73
+ # rebuild the wheel with shared libraries included and place in output dir
74
+ shell (['delocate-wheel' , '-w' , output_dir , temp_wheel ], env = env )
75
+
76
+ # Grab the built wheel for this platform
77
+ # Note: filter wheels *must* be run from inside the build environment
78
+ filter_wheels = os .path .join (os .path .dirname (__file__ ), 'filter_wheels.py' )
79
+ stdout = shell ([python , filter_wheels , output_dir + '/*.whl' ], env = env )
80
+ wheels = re .findall (r"^%s/.*\.whl$" % output_dir , stdout , re .MULTILINE )
74
81
75
82
# install the wheel
76
- shell ([pip , 'install' , package_name , '--no-index' , '--find-links' , output_dir ] , env = env )
83
+ shell ([pip , 'install' ] + wheels , env = env )
77
84
78
85
# test the wheel
79
86
if test_requires :
0 commit comments