71 lines
3.0 KiB
Diff
71 lines
3.0 KiB
Diff
From 01ee3df6d1d441bcea54e136c4990ad4ff1ec0f2 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 071/N] distutils: 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 4c47f2e..ab61a86 100644
|
|
--- a/Lib/distutils/ccompiler.py
|
|
+++ b/Lib/distutils/ccompiler.py
|
|
@@ -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:
|
|
@@ -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 @@ 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'):
|
|
@@ -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
|