]> granicus.if.org Git - python/commitdiff
[Bug #668662] Patch from Pearu Pearson: if a C source file is
authorAndrew M. Kuchling <amk@amk.ca>
Wed, 26 Feb 2003 18:52:07 +0000 (18:52 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Wed, 26 Feb 2003 18:52:07 +0000 (18:52 +0000)
    specified with an absolute path, the object file is also
    written to an absolute path.  The patch drops the drive and
    leading '/' from the source path, so a path like /path/to/foo.c
    results in an object file like build/temp.i686linux/path/to/foo.o.

Lib/distutils/ccompiler.py

index bfcf1279f17978901e02e4b15e36daf3fb8e5649..46fb743db00536a6d7484b63759ddae786c5b52e 100644 (file)
@@ -932,6 +932,8 @@ class CCompiler:
         obj_names = []
         for src_name in source_filenames:
             base, ext = os.path.splitext(src_name)
+            base = os.path.splitdrive(base)[1] # Chop off the drive
+            base = base[os.path.isabs(base):]  # If abs, chop off leading /
             if ext not in self.src_extensions:
                 raise UnknownFileError, \
                       "unknown file type '%s' (from '%s')" % (ext, src_name)