Skip to content

Commit 1400152

Browse files
committed
Extract a classmethod _make_out_path_exts suitable for isolated testing.
1 parent d13d5a7 commit 1400152

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

distutils/ccompiler.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,10 +969,16 @@ def out_extensions(self):
969969
return dict.fromkeys(self.src_extensions, self.obj_extension)
970970

971971
def _make_out_path(self, output_dir, strip_dir, src_name):
972+
return self._make_out_path_exts(
973+
output_dir, strip_dir, src_name, self.out_extensions
974+
)
975+
976+
@classmethod
977+
def _make_out_path_exts(cls, output_dir, strip_dir, src_name, extensions):
972978
base, ext = os.path.splitext(src_name)
973-
base = self._make_relative(base)
979+
base = cls._make_relative(base)
974980
try:
975-
new_ext = self.out_extensions[ext]
981+
new_ext = extensions[ext]
976982
except LookupError:
977983
raise UnknownFileError(f"unknown file type '{ext}' (from '{src_name}')")
978984
if strip_dir:

0 commit comments

Comments
 (0)