diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2022-08-21 13:56:49 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2022-08-21 13:56:49 -0400 |
commit | b4839e908ede7aa91821958d7aee83b769dc2ed5 (patch) | |
tree | b7828655f90d964815699b0709f5bbf55a1f0b34 | |
parent | 66c7e69716bed08f5404ac401da508c97b16aa8a (diff) | |
download | python-setuptools-git-b4839e908ede7aa91821958d7aee83b769dc2ed5.tar.gz |
Extract method for _make_out_path.
-rw-r--r-- | distutils/ccompiler.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/distutils/ccompiler.py b/distutils/ccompiler.py index 1c52965e..a1346440 100644 --- a/distutils/ccompiler.py +++ b/distutils/ccompiler.py @@ -923,18 +923,21 @@ int main (int argc, char **argv) { 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) - base = self._make_relative(base) - if ext not in self.src_extensions: - raise UnknownFileError( - "unknown file type '{}' (from '{}')".format(ext, src_name) - ) - if strip_dir: - base = os.path.basename(base) - obj_names.append(os.path.join(output_dir, base + self.obj_extension)) - return obj_names + return list( + self._make_out_path(output_dir, strip_dir, src_name) + for src_name in source_filenames + ) + + 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: + 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) @staticmethod def _make_relative(base): |