--- python2.5-2.5.2.orig/Lib/distutils/command/build_ext.py +++ python2.5-2.5.2/Lib/distutils/command/build_ext.py @@ -542,7 +542,7 @@ for source in sources: (base, ext) = os.path.splitext(source) if ext == ".i": # SWIG interface file - new_sources.append(base + '_wrap' + target_ext) + new_sources.append(os.path.join(self.build_temp,base + '_wrap' + target_ext)) swig_sources.append(source) swig_targets[source] = new_sources[-1] else: @@ -565,7 +565,9 @@ for source in swig_sources: target = swig_targets[source] log.info("swigging %s to %s", source, target) - self.spawn(swig_cmd + ["-o", target, source]) + self.mkpath(os.path.dirname(target)) + self.mkpath(self.build_lib) + self.spawn(swig_cmd + ["-o", target, "-outdir", self.build_lib, source]) return new_sources --- python2.5-2.5.2.orig/Lib/distutils/ccompiler.py +++ python2.5-2.5.2/Lib/distutils/ccompiler.py @@ -984,7 +984,11 @@ if ext not in self.src_extensions: raise UnknownFileError, \ "unknown file type '%s' (from '%s')" % (ext, src_name) - if strip_dir: + # chop of drive and leading / for the following comparison, too + compare_output_dir = output_dir[os.path.isabs(os.path.splitdrive(output_dir)[1]):] + # also strip the dir if the base file is already in the output directory + if strip_dir or os.path.commonprefix([compare_output_dir, base]) \ + == compare_output_dir: base = os.path.basename(base) obj_names.append(os.path.join(output_dir, base + self.obj_extension))