1
1
import os
2
+ import shlex
2
3
import shutil
3
4
import subprocess
4
5
import sys
19
20
IS_RUNNING_ON_TRAVIS = os .environ .get ('TRAVIS_OS_NAME' ) == 'windows'
20
21
21
22
22
- def call (args , env = None , cwd = None ):
23
- print ('+ ' + ' ' .join (args ))
24
- return subprocess .check_call (' ' .join (args ), env = env , cwd = cwd , shell = True )
23
+ def call (args , env = None , cwd = None , shell = False ):
24
+ # print the command executing for the logs
25
+ if shell :
26
+ print ('+ %s' % args )
27
+ else :
28
+ print ('+ ' + ' ' .join (shlex .quote (a ) for a in args ))
25
29
30
+ return subprocess .check_call (args , env = env , cwd = cwd , shell = shell )
26
31
27
32
def get_nuget_args (version , arch ):
28
33
python_name = 'python' if version [0 ] == '3' else 'python2'
@@ -165,7 +170,7 @@ def build(project_dir, output_dir, test_command, before_test, test_requires, tes
165
170
# run the before_build command
166
171
if before_build :
167
172
before_build_prepared = prepare_command (before_build , project = abs_project_dir )
168
- call ([before_build_prepared ], env = env )
173
+ call ([before_build_prepared ], env = env , shell = True )
169
174
170
175
# build the wheel
171
176
if os .path .exists (built_wheel_dir ):
@@ -183,7 +188,7 @@ def build(project_dir, output_dir, test_command, before_test, test_requires, tes
183
188
shutil .move (built_wheel , repaired_wheel_dir )
184
189
else :
185
190
repair_command_prepared = prepare_command (repair_command , wheel = built_wheel , dest_dir = repaired_wheel_dir )
186
- call ([repair_command_prepared ], env = env )
191
+ call ([repair_command_prepared ], env = env , shell = True )
187
192
repaired_wheel = glob (os .path .join (repaired_wheel_dir , '*.whl' ))[0 ]
188
193
189
194
if test_command :
@@ -213,7 +218,7 @@ def build(project_dir, output_dir, test_command, before_test, test_requires, tes
213
218
214
219
if before_test :
215
220
before_test_prepared = prepare_command (before_test , project = abs_project_dir )
216
- call ([before_test_prepared ], env = virtualenv_env )
221
+ call ([before_test_prepared ], env = virtualenv_env , shell = True )
217
222
218
223
# install the wheel
219
224
call (['pip' , 'install' , repaired_wheel + test_extras ], env = virtualenv_env )
@@ -226,7 +231,7 @@ def build(project_dir, output_dir, test_command, before_test, test_requires, tes
226
231
# (this ensures that Python runs the tests against the installed wheel
227
232
# and not the repo code)
228
233
test_command_prepared = prepare_command (test_command , project = abs_project_dir )
229
- call ([test_command_prepared ], cwd = 'c:\\ ' , env = virtualenv_env )
234
+ call ([test_command_prepared ], cwd = 'c:\\ ' , env = virtualenv_env , shell = True )
230
235
231
236
# clean up
232
237
shutil .rmtree (venv_dir )
0 commit comments