[Distutils] ccompiler problem

Thomas Heller thomas.heller@ion-tof.com
Fri, 23 Jun 2000 10:57:29 +0200


Consider the object_filenames method:

    def object_filenames (self,
                          source_filenames,
                          strip_dir=0,
                          output_dir=''):
        if output_dir is None: output_dir = ''
        obj_names = []
        for src_name in source_filenames:
            (base, ext) = os.path.splitext (src_name)
            if ext not in self.src_extensions:
                continue
                ^^^^^^^^^ Problem is here
            if strip_dir:
                base = os.path.basename (base)
            obj_names.append (os.path.join (output_dir,
                                            base + self.obj_extension))
        return obj_names

    # object_filenames ()

If you specify a source-file with an unknown extension
in the sources list, you later get a traceback later
saying something like 'sources and targets must have the same length'.
IMO we have two possibilities here:
- assume that 'ext' is something which should be passed to the linker
- raise an error like 'Don't know how to compile this file'

Thomas Heller
ION-TOF GmbH