Skip to content

Commit 7c4f345

Browse files
committed
change windows call to not always call shell
1 parent a276abb commit 7c4f345

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

cibuildwheel/windows.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import shlex
23
import shutil
34
import subprocess
45
import sys
@@ -19,10 +20,14 @@
1920
IS_RUNNING_ON_TRAVIS = os.environ.get('TRAVIS_OS_NAME') == 'windows'
2021

2122

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))
2529

30+
return subprocess.check_call(args, env=env, cwd=cwd, shell=shell)
2631

2732
def get_nuget_args(version, arch):
2833
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
165170
# run the before_build command
166171
if before_build:
167172
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)
169174

170175
# build the wheel
171176
if os.path.exists(built_wheel_dir):
@@ -183,7 +188,7 @@ def build(project_dir, output_dir, test_command, before_test, test_requires, tes
183188
shutil.move(built_wheel, repaired_wheel_dir)
184189
else:
185190
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)
187192
repaired_wheel = glob(os.path.join(repaired_wheel_dir, '*.whl'))[0]
188193

189194
if test_command:
@@ -213,7 +218,7 @@ def build(project_dir, output_dir, test_command, before_test, test_requires, tes
213218

214219
if before_test:
215220
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)
217222

218223
# install the wheel
219224
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
226231
# (this ensures that Python runs the tests against the installed wheel
227232
# and not the repo code)
228233
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)
230235

231236
# clean up
232237
shutil.rmtree(venv_dir)

0 commit comments

Comments
 (0)