diff --git a/setup.py b/setup.py index a326a94282b8720d33b7f8a394cac23108275772..65d57367fd00feec40112b44d7199e9e599fd583 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,7 @@ import sys import shutil import multiprocessing import subprocess +import shlex from typing import List from pathlib import Path from setuptools import find_packages, setup @@ -320,7 +321,7 @@ class CustomBuildExt(build_ext): """Run CMake configuration and build commands.""" # Combine all cmake commands into one string cmake_cmd = ( - f"source {self.env_script_path} && " + f"source {shlex.quote(self.env_script_path)} && " f"cmake -S ./ -B {self.build_ops_dir}" f" -DCMAKE_BUILD_TYPE={self.build_type}" f" -DCMAKE_INSTALL_PREFIX={os.path.join(self.build_ops_dir, 'install')}" @@ -328,7 +329,7 @@ class CustomBuildExt(build_ext): f" -DBUILD_EXTENSION_DIR={self.build_extension_dir}" f" -DASCENDC_INSTALL_PATH={self.package_path}" f" -DMS_EXTENSION_NAME={self.ext_name}" - f" -DASCEND_CANN_PACKAGE_PATH={self.ascend_home_path} && " + f" -DASCEND_CANN_PACKAGE_PATH={shlex.quote(self.ascend_home_path)} && " f"cmake --build {self.build_ops_dir} -j{self.compile_cores}" )