Skip to content

Commit 20f9825

Browse files
authored
Fix using unquoted environment variable for clang path (#386)
* Use shlex.quote for clang path * Fix "The system cannot find the file specified" * Use shlex.quote only on Linux
1 parent 545aac7 commit 20f9825

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

setup.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import setuptools.command.install as orig_install
1818
import setuptools.command.develop as orig_develop
1919
import subprocess
20-
import shutil
20+
import shlex
2121
from setuptools import Extension, find_packages, setup
2222
from Cython.Build import cythonize
2323

@@ -103,13 +103,12 @@ def _get_cmdclass():
103103

104104
def spirv_compile():
105105
if IS_LIN:
106-
compiler = os.path.join(
107-
os.environ.get("ONEAPI_ROOT"), "compiler/latest/linux", "bin/clang"
108-
)
106+
compiler = "compiler/latest/linux/bin/clang"
107+
compiler = os.path.join(os.environ.get("ONEAPI_ROOT"), compiler)
108+
compiler = shlex.quote(compiler)
109109
if IS_WIN:
110-
compiler = os.path.join(
111-
os.environ.get("ONEAPI_ROOT"), "compiler/latest/windows", "bin/clang.exe"
112-
)
110+
compiler = "compiler\\latest\\windows\\bin\\clang.exe"
111+
compiler = os.path.join(os.environ.get("ONEAPI_ROOT"), compiler)
113112
clang_args = [
114113
compiler,
115114
"-flto",

0 commit comments

Comments
 (0)