@@ -32,21 +32,27 @@ def find_compiler():
3232 raise RuntimeError ('Unable to locate a compiler for preprocessing assembly' )
3333
3434
35+ def normalize_path (value ):
36+ return str (value ).strip ().strip ('"' )
37+
38+
3539def preprocess (args ):
3640 compiler = find_compiler ()
37- output = Path (args .output )
41+ input_path = normalize_path (args .input )
42+ output = Path (normalize_path (args .output ))
43+ include_dirs = [normalize_path (include_dir ) for include_dir in args .include_dir ]
3844 output .parent .mkdir (parents = True , exist_ok = True )
3945
4046 if os .name == 'nt' and Path (compiler [0 ]).name .lower () in ('cl.exe' , 'cl' , 'clang-cl.exe' , 'clang-cl' ):
4147 command = compiler + ['/nologo' , '/EP' , '/TC' ]
42- command += [f'/I{ include_dir } ' for include_dir in args . include_dir ]
48+ command += [f'/I{ include_dir } ' for include_dir in include_dirs ]
4349 command += [f'/D{ define } ' for define in args .define ]
44- command += [args . input ]
50+ command += [input_path ]
4551 else :
4652 command = compiler + ['-E' , '-P' , '-x' , 'c' ]
47- command += [f'-I{ include_dir } ' for include_dir in args . include_dir ]
53+ command += [f'-I{ include_dir } ' for include_dir in include_dirs ]
4854 command += [f'-D{ define } ' for define in args .define ]
49- command += [args . input ]
55+ command += [input_path ]
5056
5157 result = subprocess .run (command , capture_output = True , text = True )
5258 if result .returncode != 0 :
0 commit comments