diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2022-08-21 14:15:00 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2022-08-21 14:15:00 -0400 |
commit | e982d51b755c004397303e33df7d2fa2eb09b4d3 (patch) | |
tree | 2479eb80c4d7129dc956065239d7901af3aa0ee0 | |
parent | d14faf0d29c61373570de9a7d82185752b56e37e (diff) | |
download | python-setuptools-git-e982d51b755c004397303e33df7d2fa2eb09b4d3.tar.gz |
Extract property for mapping src extensions to out extensions.
-rw-r--r-- | distutils/ccompiler.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/distutils/ccompiler.py b/distutils/ccompiler.py index a1346440..97551c99 100644 --- a/distutils/ccompiler.py +++ b/distutils/ccompiler.py @@ -928,16 +928,22 @@ int main (int argc, char **argv) { for src_name in source_filenames ) + @property + def out_extensions(self): + return dict.fromkeys(self.src_extensions, self.obj_extension) + def _make_out_path(self, output_dir, strip_dir, src_name): base, ext = os.path.splitext(src_name) base = self._make_relative(base) - if ext not in self.src_extensions: + try: + new_ext = self.out_extensions[ext] + except LookupError: raise UnknownFileError( "unknown file type '{}' (from '{}')".format(ext, src_name) ) if strip_dir: base = os.path.basename(base) - return os.path.join(output_dir, base + self.obj_extension) + return os.path.join(output_dir, base + new_ext) @staticmethod def _make_relative(base): |