Skip to content

Commit ce89b3e

Browse files
committed
Fix wheelbuilder passing specs to shell scripts
1 parent 9a245a1 commit ce89b3e

File tree

6 files changed

+32
-6
lines changed

6 files changed

+32
-6
lines changed

scripts/wheelbuilder/build_wheels.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import importlib
5252
import os
5353
import re
54+
import shlex
5455
import shutil
5556
import subprocess
5657
import sys
@@ -107,6 +108,7 @@ def build_wheels(pip):
107108
packages_to_build = set()
108109
with open(join(dirname(__file__), "packages.txt")) as f:
109110
for line in f.readlines():
111+
line = line.strip()
110112
name, version = line.split("==")
111113
if not packages_selected or name in packages_selected or line in packages_selected:
112114
packages_to_build.add(line)
@@ -131,7 +133,11 @@ def build_wheels(pip):
131133
env["PATH"] = abspath(dirname(pip)) + os.pathsep + env["PATH"]
132134
env["VIRTUAL_ENV"] = abspath(dirname(dirname(pip)))
133135
print("Building", name, version, "with", script, flush=True)
134-
subprocess.check_call([script, version], shell=True, env=env)
136+
if sys.platform == "win32":
137+
cmd = [script, version] # Python's subprocess.py does the quoting we need
138+
else:
139+
cmd = f"{shlex.quote(script)} {version}"
140+
subprocess.check_call(cmd, shell=True, env=env)
135141
if not len(glob("*.whl")) > whl_count:
136142
print("Building wheel for", name, version, "after", script, "did not", flush=True)
137143
subprocess.check_call([pip, "wheel", spec])

scripts/wheelbuilder/darwin/scipy.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,8 @@ if [ -n "$GITHUB_RUN_ID" ]; then
4242
export PKG_CONFIG_PATH=/opt/homebrew/opt/openblas/lib/pkgconfig
4343
fi
4444
export FFLAGS=-fallow-argument-mismatch
45-
pip wheel "scipy==$1"
45+
if [ -n "$1" ]; then
46+
pip wheel "scipy==$1"
47+
else
48+
pip wheel scipy
49+
fi

scripts/wheelbuilder/darwin/torch.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,8 @@ if [ -n "$GITHUB_RUN_ID" ]; then
4444
fi
4545
export MAX_JOBS=4
4646
export BUILD_TEST=0
47-
pip wheel "torch==$1"
47+
if [ -n "$1" ]; then
48+
pip wheel "torch==$1"
49+
else
50+
pip wheel torch
51+
fi

scripts/wheelbuilder/linux/scipy.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,8 @@ if command -v manylinux-interpreters 2>&1 >/dev/null; then
4141
dnf install -y gcc-toolset-12-gcc-gfortran openblas-devel
4242
fi
4343
export FFLAGS=-fallow-argument-mismatch
44-
pip wheel "scipy==$1"
44+
if [ -n "$1" ]; then
45+
pip wheel "scipy==$1"
46+
else
47+
pip wheel scipy
48+
fi

scripts/wheelbuilder/linux/tensorflow.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,9 @@ curl -L https://github.com/bazelbuild/bazel/releases/download/6.4.0/bazel-6.4.0-
4747
chmod +x tmp_bazel/bazel
4848
export PATH=$(pwd)/tmp_bazel/:$PATH
4949
bazel --version
50-
pip wheel "tensorflow==$1"
50+
if [ -n "$1" ]; then
51+
pip wheel "tensorflow==$1"
52+
else
53+
pip wheel tensorflow
54+
fi
5155
rm -rf tmp_bazel

scripts/wheelbuilder/linux/torch.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,8 @@ if command -v manylinux-interpreters 2>&1 >/dev/null; then
4343
fi
4444
export MAX_JOBS=4
4545
export BUILD_TEST=0
46-
pip wheel "torch==$1"
46+
if [ -n "$1" ]; then
47+
pip wheel "torch==$1"
48+
else
49+
pip wheel torch
50+
fi

0 commit comments

Comments
 (0)