Skip to content

Commit

Permalink
distutils: use Mingw32CCompiler as default compiler for m
Browse files Browse the repository at this point in the history
Co-authored-by: Алексей <[email protected]>
  • Loading branch information
Alexpux authored and lazka committed Jul 19, 2023
1 parent 48275e5 commit 27b9036
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Lib/distutils/ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from distutils.file_util import move_file
from distutils.dir_util import mkpath
from distutils.dep_util import newer_group
from distutils.util import split_quoted, execute
from distutils.util import split_quoted, execute, get_platform
from distutils import log

class CCompiler:
Expand Down Expand Up @@ -948,6 +948,8 @@ def get_default_compiler(osname=None, platform=None):
osname = os.name
if platform is None:
platform = sys.platform
if get_platform().startswith('mingw'):
return 'mingw32'
for pattern, compiler in _default_compilers:
if re.match(pattern, platform) is not None or \
re.match(pattern, osname) is not None:
Expand Down
11 changes: 8 additions & 3 deletions Lib/distutils/cygwinccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,16 @@ def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
output_dir = ''
obj_names = []
for src_name in source_filenames:
# use normcase to make sure '.rc' is really '.rc' and not '.RC'
base, ext = os.path.splitext(os.path.normcase(src_name))
base, ext = os.path.splitext(src_name)
# use 'normcase' only for resource suffixes
ext_normcase = os.path.normcase(ext)
if ext_normcase in ['.rc','.res']:
ext = ext_normcase
if ext not in (self.src_extensions + ['.rc','.res']):
raise UnknownFileError("unknown file type '%s' (from '%s')" % \
(ext, src_name))
base = os.path.splitdrive(base)[1] # Chop off the drive
base = base[os.path.isabs(base):] # If abs, chop off leading /
if strip_dir:
base = os.path.basename (base)
if ext in ('.res', '.rc'):
Expand Down Expand Up @@ -313,7 +318,7 @@ def __init__(self, verbose=0, dry_run=0, force=0):

# Include the appropriate MSVC runtime library if Python was built
# with MSVC 7.0 or later.
self.dll_libraries = get_msvcr()
self.dll_libraries = get_msvcr() or []

# Because these compilers aren't configured in Python's pyconfig.h file by
# default, we should at least warn the user if he is using an unmodified
Expand Down

0 comments on commit 27b9036

Please sign in to comment.