Skip to content

Commit c6425d5

Browse files
authored
Fix building Python wheels for Windows (#3355)
1 parent 3f985a4 commit c6425d5

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

cmake/cmake_extension.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,12 @@ def build_extension(self, ext: setuptools.extension.Extension):
190190

191191
print(f"build command is:\n{build_cmd}")
192192

193-
# Build cmake command as a list to prevent command injection
194-
# Use shlex.split() for safer parsing of user-provided arguments
195193
cmake_configure_cmd = (
196-
["cmake"]
197-
+ shlex.split(cmake_args)
198-
+ ["-B", str(self.build_temp), "-S", str(sherpa_onnx_dir)]
194+
f'cmake {cmake_args} -B "{self.build_temp}" -S "{sherpa_onnx_dir}"'
199195
)
200196
print("cmake_configure_cmd", cmake_configure_cmd)
201197

202-
ret = subprocess.run(cmake_configure_cmd, shell=False).returncode
198+
ret = subprocess.run(cmake_configure_cmd, shell=True).returncode
203199

204200
if ret != 0:
205201
raise Exception("Failed to configure sherpa-onnx")

0 commit comments

Comments
 (0)