Skip to content

Commit

Permalink
Change the get_platform() method in sysconfig
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
naveen521kk authored and lazka committed Aug 25, 2023
1 parent 88f7241 commit ea83317
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Lib/sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,20 @@ def get_platform():
"""
if os.name == 'nt':
if 'GCC' in sys.version:
return 'mingw'
if 'gcc' in sys.version.lower():
if 'ucrt' in sys.version.lower():
if 'amd64' in sys.version.lower():
return 'mingw_x86_64_ucrt'
return 'mingw_i686_ucrt'
if 'clang' in sys.version.lower():
if 'amd64' in sys.version.lower():
return 'mingw_x86_64_clang'
if 'arm64' in sys.version.lower():
return 'mingw_aarch64'
return 'mingw_i686_clang'
if 'amd64' in sys.version.lower():
return 'mingw_x86_64'
return 'mingw_i686'
if 'amd64' in sys.version.lower():
return 'win-amd64'
if '(arm)' in sys.version.lower():
Expand Down
4 changes: 4 additions & 0 deletions Python/getcompiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@
#define COMPILER COMP_SEP "[GCC Clang " xstr(__clang_major__) "." \
xstr(__clang_minor__) "." xstr(__clang_patchlevel__) ARCH_SUFFIX "]"
#else
#if defined(_UCRT)
#define COMPILER COMP_SEP "[GCC UCRT " __VERSION__ ARCH_SUFFIX "]"
#else
#define COMPILER COMP_SEP "[GCC " __VERSION__ ARCH_SUFFIX "]"
#endif
#endif
// Generic fallbacks.
#elif defined(__cplusplus)
#define COMPILER "[C++]"
Expand Down

0 comments on commit ea83317

Please sign in to comment.