@@ -97,25 +97,23 @@ class L(list): __bool__ = lambda self: True
9797be .run ()
9898cc = be .compiler
9999cc .initialize ()
100- # On setuptools versions that use "local" distutils,
101- # ``cc.spawn(["dumpbin", ... ])`` and ``cc.spawn(["lib", ...])`` no longer
102- # manage to locate the right executables, even though they are correctly on the
103- # PATH; instead, use shutil.which to walk the PATH and get absolute executable
104- # paths.
100+ # On setuptools versions that use "local" distutils, ``cc.spawn(["dumpbin",
101+ # ... ])`` and ``cc.spawn(["lib", ...])`` no longer manage to locate the right
102+ # executables, even though they are correctly on the PATH, because only the env
103+ # kwarg to Popen() is updated, and not os.environ[" PATH"]. Use shutil.which to
104+ # walk the PATH and get absolute executable paths.
105105with TemporaryDirectory () as tmpdir :
106- dest = Path (dest , "path" )
106+ dumpbin_path = Path (dest , "dumpbin" )
107+ lib_path = Path (dest , "lib" )
107108 cc .spawn ([
108- "python" , "-c" ,
109- f"from shutil import which; "
110- f"print(which('dumpbin'), file=open({ str (dest )!r} , 'w'), end='')" ,
109+ sys .executable , "-c" ,
110+ "import pathlib, shutil, sys\n "
111+ "for exec in ['dumpbin', 'lib']:\n "
112+ " pathlib.Path(sys.argv[1], exec).write_text(shutil.which(exec))\n " ,
113+ tmpdir ,
111114 ])
112- dumpbin_path = dest .read_text ()
113- cc .spawn ([
114- "python" , "-c" ,
115- f"from shutil import which; "
116- f"print(which('lib'), file=open({ str (dest )!r} , 'w'), end='')" ,
117- ])
118- lib_path = dest .read_text ()
115+ dumpbin_path = Path (tmpdir , "dumpbin" ).read_text ()
116+ lib_path = Path (tmpdir , "lib" ).read_text ()
119117# Build the import library.
120118cc .spawn (
121119 [dumpbin_path , "/EXPORTS" , "/OUT:cairo/win64/cairo.exports" ,
0 commit comments