| From 88fba0fa0fcc87ea40fbd329f5e21ab6ebbe6f29 Mon Sep 17 00:00:00 2001 |
| From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= |
| <alexey.pawlow@gmail.com> |
| Date: Thu, 17 Jun 2021 18:51:35 +0530 |
| Subject: [PATCH 025/N] MINGW use Mingw32CCompiler as default compiler for m |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| Co-authored-by: Алексей <alexey.pawlow@gmail.com> |
| --- |
| Lib/distutils/ccompiler.py | 4 +++- |
| Lib/distutils/cygwinccompiler.py | 11 ++++++++--- |
| 2 files changed, 11 insertions(+), 4 deletions(-) |
| |
| diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py |
| index b5ef143..24eafc6 100644 |
| --- a/Lib/distutils/ccompiler.py |
| +++ b/Lib/distutils/ccompiler.py |
| @@ -9,7 +9,7 @@ from distutils.spawn import spawn |
| 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: |
| @@ -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: |
| diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py |
| index 66c12dd..1960ef8 100644 |
| --- a/Lib/distutils/cygwinccompiler.py |
| +++ b/Lib/distutils/cygwinccompiler.py |
| @@ -253,11 +253,16 @@ class CygwinCCompiler(UnixCCompiler): |
| 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'): |
| @@ -313,7 +318,7 @@ class Mingw32CCompiler(CygwinCCompiler): |
| |
| # 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 |
| -- |
| 2.32.0 |
| |