Skip to content

Commit

Permalink
Extract a classmethod _make_out_path_exts suitable for isolated testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jan 4, 2025
1 parent d13d5a7 commit 1400152
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions distutils/ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,10 +969,16 @@ def out_extensions(self):
return dict.fromkeys(self.src_extensions, self.obj_extension)

def _make_out_path(self, output_dir, strip_dir, src_name):
return self._make_out_path_exts(
output_dir, strip_dir, src_name, self.out_extensions
)

@classmethod
def _make_out_path_exts(cls, output_dir, strip_dir, src_name, extensions):
base, ext = os.path.splitext(src_name)
base = self._make_relative(base)
base = cls._make_relative(base)
try:
new_ext = self.out_extensions[ext]
new_ext = extensions[ext]
except LookupError:
raise UnknownFileError(f"unknown file type '{ext}' (from '{src_name}')")
if strip_dir:
Expand Down

0 comments on commit 1400152

Please sign in to comment.