Skip to content

Commit 36ce8b3

Browse files
committed
Refactor for simplicity.
1 parent ede1af2 commit 36ce8b3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

distutils/ccompiler.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -983,14 +983,13 @@ def _make_out_path_exts(cls, output_dir, strip_dir, src_name, extensions):
983983
>>> CCompiler._make_out_path_exts('.', True, '/foo/bar.c', exts).replace('\\', '/')
984984
'./bar.o'
985985
"""
986-
base, ext = os.path.splitext(src_name)
987-
base = pathlib.PurePath(base)
986+
src = pathlib.PurePath(src_name)
988987
# Ensure base is relative to honor output_dir (python/cpython#37775).
989-
base = cls._make_relative(base)
988+
base = cls._make_relative(src)
990989
try:
991-
new_ext = extensions[ext]
990+
new_ext = extensions[src.suffix]
992991
except LookupError:
993-
raise UnknownFileError(f"unknown file type '{ext}' (from '{src_name}')")
992+
raise UnknownFileError(f"unknown file type '{src.suffix}' (from '{src}')")
994993
if strip_dir:
995994
base = pathlib.PurePath(base.name)
996995
return os.path.join(output_dir, base.with_suffix(new_ext))

0 commit comments

Comments
 (0)