Skip to content

Commit

Permalink
👹 Feed the hobgoblins (delint).
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Feb 13, 2024
1 parent f1ce76d commit 0e57a23
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
16 changes: 10 additions & 6 deletions distutils/cygwinccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ def __init__(self, verbose=0, dry_run=0, force=0):
linker_exe='%s -mcygwin' % self.cc,
linker_so=('{} -mcygwin {}'.format(self.linker_dll, shared_option)),
linker_exe_cxx='%s -mcygwin' % self.cxx,
linker_so_cxx=('%s -mcygwin %s' %
(self.linker_dll_cxx, shared_option)),
linker_so_cxx=('%s -mcygwin %s' % (self.linker_dll_cxx, shared_option)),
)

# Include the appropriate MSVC runtime library if Python was built
Expand Down Expand Up @@ -146,11 +145,16 @@ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
else: # for other files use the C-compiler
try:
if self.detect_language(src) == 'c++':
self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
extra_postargs)
self.spawn(
self.compiler_so_cxx
+ cc_args
+ [src, '-o', obj]
+ extra_postargs
)
else:
self.spawn(
self.compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
self.compiler_so + cc_args + [src, '-o', obj] + extra_postargs
)
except DistutilsExecError as msg:
raise CompileError(msg)

Expand Down Expand Up @@ -291,7 +295,7 @@ def __init__(self, verbose=0, dry_run=0, force=0):
linker_exe='%s' % self.cc,
linker_so='{} {}'.format(self.linker_dll, shared_option),
linker_exe_cxx='%s' % self.cxx,
linker_so_cxx='%s %s' % (self.linker_dll_cxx, shared_option)
linker_so_cxx='%s %s' % (self.linker_dll_cxx, shared_option),
)

def runtime_library_dir_option(self, dir):
Expand Down
14 changes: 10 additions & 4 deletions distutils/unixccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,9 @@ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
compiler_so_cxx = compiler_fixup(self.compiler_so_cxx, cc_args + extra_postargs)
try:
if self.detect_language(src) == 'c++':
self.spawn(compiler_so_cxx + cc_args + [ src, '-o', obj] +
extra_postargs)
self.spawn(
compiler_so_cxx + cc_args + [src, '-o', obj] + extra_postargs
)
else:
self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
except DistutilsExecError as msg:
Expand Down Expand Up @@ -258,8 +259,13 @@ def link(
# building an executable or linker_so (with shared options)
# when building a shared library.
building_exe = target_desc == CCompiler.EXECUTABLE
linker = (self.linker_exe if building_exe else (self.linker_so_cxx if
target_lang == "c++" else self.linker_so))[:]
linker = (
self.linker_exe
if building_exe
else (
self.linker_so_cxx if target_lang == "c++" else self.linker_so
)
)[:]

if target_lang == "c++" and self.compiler_cxx:
env, linker_ne = _split_env(linker)
Expand Down

0 comments on commit 0e57a23

Please sign in to comment.