[Distutils] Patch for build_ext.py (Win32)
Greg Ward
gward@python.net
Thu, 13 Apr 2000 20:45:59 -0400
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!!