From 4ed89c9ec6e2751d7da9a45821038c54975dc559 Mon Sep 17 00:00:00 2001 From: zhang_xu_hao1230 Date: Wed, 9 Jul 2025 16:35:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index b80c7879..a8be7373 100644 --- a/setup.py +++ b/setup.py @@ -131,7 +131,8 @@ class CustomBuildExt(build_ext): env_script_path = _get_ascend_env_path() build_extension_dir = os.path.join(BUILD_OPS_DIR, "kernel_meta", ext_name) # Combine all cmake commands into one string - cmake_cmd = ( + cmake_cmd = [ + "bash", "-c", f"source {env_script_path} && " f"cmake -S {OPS_DIR} -B {BUILD_OPS_DIR}" f" -DCMAKE_BUILD_TYPE=Release" @@ -140,12 +141,12 @@ class CustomBuildExt(build_ext): f" -DMS_EXTENSION_NAME={ext_name}" f" -DASCEND_CANN_PACKAGE_PATH={ascend_home_path} && " f"cmake --build {BUILD_OPS_DIR} -j --verbose" - ) + ] try: # Run the combined cmake command - logger.info(f"Running combined CMake commands:\n{cmake_cmd}") - result = subprocess.run(cmake_cmd, cwd=self.ROOT_DIR, text=True, shell=True, capture_output=True) + logger.info(f"Running combined CMake commands:\n{' '.join(cmake_cmd[2:])}") + result = subprocess.run(cmake_cmd, cwd=self.ROOT_DIR, text=True, shell=False, capture_output=True) if result.returncode != 0: logger.info("CMake commands failed:") logger.info(result.stdout) # Print standard output -- Gitee