Changeset 395 for python


Ignore:
Timestamp:
Mar 21, 2014, 7:20:05 PM (11 years ago)
Author:
dmik
Message:

python: Fix EMXCompiler to stop polluting source tree with .obj files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/trunk/Lib/distutils/emxccompiler.py

    r391 r395  
    3030
    3131class EMXCCompiler (UnixCCompiler):
     32
     33    _rc_extensions = ['.rc', '.RC']
    3234
    3335    compiler_type = 'emx'
     
    171173    # -- Miscellaneous methods -----------------------------------------
    172174
    173     # override the object_filenames method from CCompiler to
    174     # support rc and res-files
    175175    def object_filenames (self,
    176176                          source_filenames,
    177177                          strip_dir=0,
    178178                          output_dir=''):
     179        # Copied from ccompiler.py, extended to return .res as 'object'-file
     180        # for .rc input file
    179181        if output_dir is None: output_dir = ''
    180182        obj_names = []
    181183        for src_name in source_filenames:
    182             # use normcase to make sure '.rc' is really '.rc' and not '.RC'
    183             (base, ext) = os.path.splitext (os.path.normcase(src_name))
    184             if ext not in (self.src_extensions + ['.rc']):
     184            (base, ext) = os.path.splitext (src_name)
     185            base = os.path.splitdrive(base)[1] # Chop off the drive
     186            base = base[os.path.isabs(base):]  # If abs, chop off leading /
     187            if ext not in (self.src_extensions + self._rc_extensions):
    185188                raise UnknownFileError, \
    186189                      "unknown file type '%s' (from '%s')" % \
     
    188191            if strip_dir:
    189192                base = os.path.basename (base)
    190             if ext == '.rc':
    191                 # these need to be compiled to object files
     193            if ext in self._rc_extensions:
    192194                obj_names.append (os.path.join (output_dir,
    193                                             base + self.res_extension))
     195                                                base + self.res_extension))
    194196            else:
    195197                obj_names.append (os.path.join (output_dir,
    196                                             base + self.obj_extension))
     198                                                base + self.obj_extension))
    197199        return obj_names
    198200
Note: See TracChangeset for help on using the changeset viewer.