Skip to content

Commit ea83317

Browse files
naveen521kklazka
authored andcommitted
Change the get_platform() method in sysconfig
This would possibly fix building wheels when mingw python is used and would be unique to each python same as EXT_SUFFIX. Also, this modifies the `sys.version` argument to include UCRT in it. Signed-off-by: Naveen M K <[email protected]>
1 parent 88f7241 commit ea83317

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Lib/sysconfig.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,20 @@ def get_platform():
770770
771771
"""
772772
if os.name == 'nt':
773-
if 'GCC' in sys.version:
774-
return 'mingw'
773+
if 'gcc' in sys.version.lower():
774+
if 'ucrt' in sys.version.lower():
775+
if 'amd64' in sys.version.lower():
776+
return 'mingw_x86_64_ucrt'
777+
return 'mingw_i686_ucrt'
778+
if 'clang' in sys.version.lower():
779+
if 'amd64' in sys.version.lower():
780+
return 'mingw_x86_64_clang'
781+
if 'arm64' in sys.version.lower():
782+
return 'mingw_aarch64'
783+
return 'mingw_i686_clang'
784+
if 'amd64' in sys.version.lower():
785+
return 'mingw_x86_64'
786+
return 'mingw_i686'
775787
if 'amd64' in sys.version.lower():
776788
return 'win-amd64'
777789
if '(arm)' in sys.version.lower():

Python/getcompiler.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@
3333
#define COMPILER COMP_SEP "[GCC Clang " xstr(__clang_major__) "." \
3434
xstr(__clang_minor__) "." xstr(__clang_patchlevel__) ARCH_SUFFIX "]"
3535
#else
36+
#if defined(_UCRT)
37+
#define COMPILER COMP_SEP "[GCC UCRT " __VERSION__ ARCH_SUFFIX "]"
38+
#else
3639
#define COMPILER COMP_SEP "[GCC " __VERSION__ ARCH_SUFFIX "]"
3740
#endif
41+
#endif
3842
// Generic fallbacks.
3943
#elif defined(__cplusplus)
4044
#define COMPILER "[C++]"

0 commit comments

Comments
 (0)