Patch for build_ext.py (Win32)
Here's a patch for distutils/command/build_ext.py to ensure that the output directory for scratch files created while building the extension DLL actually exists. Index: build_ext.py =================================================================== RCS file: /projects/cvsroot/distutils/distutils/command/build_ext.py,v retrieving revision 1.30 diff -c -r1.30 build_ext.py *** build_ext.py 2000/04/10 00:19:42 1.30 --- build_ext.py 2000/04/12 22:33:10 *************** *** 331,336 **** --- 331,342 ---- implib_dir = os.path.join(self.build_temp,\ self.get_ext_libname(extension_name)) extra_args.append ('/IMPLIB:' + implib_dir) + + # Ensure that this directory exists! + ext_path = string.split(extension_name, '.') + ext_path = apply(os.path.join, ext_path[:-1]) + self.mkpath(os.path.join(self.build_temp, ext_path)) + # if MSVC fullname = self.get_ext_fullname (extension_name)
On 12 April 2000, Lyle Johnson said:
Here's a patch for distutils/command/build_ext.py to ensure that the output directory for scratch files created while building the extension DLL actually exists.
No, it's the job of the CCompiler classes to ensure that the files they are about to write can be written, ie. that os.path.dirname(output_file) exists before running the compile/link/whatever that attempts to create output_file. In fact, if you look in msvccompiler.py, in the 'link_shared_object()' method, you see it being done: if self._need_link (objects, output_filename): if debug: ldflags = self.ldflags_shared_debug else: ldflags = self.ldflags_shared ld_args = ldflags + lib_opts + \ objects + ['/OUT:' + output_filename] if extra_preargs: ld_args[:0] = extra_preargs if extra_postargs: ld_args.extend (extra_postargs)
self.mkpath (os.path.dirname (output_filename)) <<<<<<
self.spawn ([self.link] + ld_args)
else: self.announce ("skipping %s (up-to-date)" % output_filename) So something must be going wrong with that 'mkpath()' call. Try applying *this* patch and see if it sheds any light on the matter: *** msvccompiler.py 2000/03/31 19:04:25 1.25 --- msvccompiler.py 2000/04/14 00:45:43 *************** *** 360,365 **** --- 360,368 ---- if extra_postargs: ld_args.extend (extra_postargs) + print "link_shared_object():" + print " output_filename =", output_filename + print " mkpath'ing:", os.path.dirname (output_filename) self.mkpath (os.path.dirname (output_filename)) self.spawn ([self.link] + ld_args) Let me know if you figure out what's going on. Greg -- Greg Ward - Unix bigot gward@python.net http://starship.python.net/~gward/ I want to so HAPPY, the VEINS in my neck STAND OUT!!
participants (2)
-
Greg Ward -
Lyle Johnson