Skip to content

Commit

Permalink
Extract property for out_extensions in _msvccompiler
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Aug 21, 2022
1 parent e982d51 commit c2d2d4b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions distutils/_msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,17 @@ def initialize(self, plat_name=None):

# -- Worker methods ------------------------------------------------

def _make_out_path(self, output_dir, strip_dir, src_name):
ext_map = {
**{ext: self.obj_extension for ext in self.src_extensions},
@property
def out_extensions(self):
return {
**super().out_extensions,
**{
ext: self.res_extension
for ext in self._rc_extensions + self._mc_extensions
},
}

def _make_out_path(self, output_dir, strip_dir, src_name):
base, ext = os.path.splitext(src_name)
if strip_dir:
base = os.path.basename(base)
Expand All @@ -335,7 +338,7 @@ def _make_out_path(self, output_dir, strip_dir, src_name):
# XXX: This may produce absurdly long paths. We should check
# the length of the result and trim base until we fit within
# 260 characters.
return os.path.join(output_dir, base + ext_map[ext])
return os.path.join(output_dir, base + self.out_extensions[ext])
except LookupError:
# Better to raise an exception instead of silently continuing
# and later complain about sources and targets having
Expand Down

0 comments on commit c2d2d4b

Please sign in to comment.