MINGW-packages/mingw-w64-python/0108-Modify-sys.winver-to-match-upstream.patch

70 lines
2.8 KiB
Diff

From 06829247e64d828cc0e44f3cbed4285246b2b7c5 Mon Sep 17 00:00:00 2001
From: Naveen M K <naveen521kk@gmail.com>
Date: Wed, 19 Jan 2022 19:39:20 +0530
Subject: [PATCH 108/N] Modify `sys.winver` to match upstream
With this change `sys.winver` will add the Arch for which
python was compiled on, for example in 32-bits, `sys.winver`
will be `3.10-32`, for arm32 it would be `3.10-arm32` and
so on.
See https://github.com/msys2-contrib/cpython-mingw/issues/40
---
configure.ac | 22 ++++++++++++++++++----
mingw_smoketests.py | 9 ++++++++-
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 1898783..1e3d91d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4809,10 +4809,24 @@ then
esac
case $host in
*-*-mingw*)
- DYNLOADFILE="dynload_win.o"
- extra_machdep_objs="$extra_machdep_objs PC/dl_nt.o"
- CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"$VERSION\"' -DPY3_DLLNAME='L\"$DLLLIBRARY\"'"
- ;;
+ DYNLOADFILE="dynload_win.o"
+ extra_machdep_objs="$extra_machdep_objs PC/dl_nt.o"
+ CFLAGS_NODIST="$CFLAGS_NODIST -DPY3_DLLNAME='L\"$DLLLIBRARY\"'"
+ case $host in
+ i686*)
+ CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"${VERSION}-32\"'"
+ ;;
+ armv7*)
+ CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"${VERSION}-arm32\"'"
+ ;;
+ aarch64*)
+ CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"${VERSION}-arm64\"'"
+ ;;
+ *)
+ CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"$VERSION\"'"
+ ;;
+ esac
+ ;;
esac
fi
AC_MSG_RESULT($DYNLOADFILE)
diff --git a/mingw_smoketests.py b/mingw_smoketests.py
index ce95846..aa76659 100644
--- a/mingw_smoketests.py
+++ b/mingw_smoketests.py
@@ -214,7 +214,14 @@ def test_platform_things(self):
ext_suffixes = importlib.machinery.EXTENSION_SUFFIXES
self.assertTrue(ext_suffix in ext_suffixes)
self.assertTrue(".pyd" in ext_suffixes)
- self.assertEqual(sys.winver, ".".join(map(str, sys.version_info[:2])))
+ if sysconfig.get_platform().startswith('mingw_i686'):
+ self.assertEqual(sys.winver, ".".join(map(str, sys.version_info[:2])) + '-32')
+ elif sysconfig.get_platform().startswith('mingw_aarch64'):
+ self.assertEqual(sys.winver, ".".join(map(str, sys.version_info[:2])) + '-arm64')
+ elif sysconfig.get_platform().startswith('mingw_armv7'):
+ self.assertEqual(sys.winver, ".".join(map(str, sys.version_info[:2])) + '-arm32')
+ else:
+ self.assertEqual(sys.winver, ".".join(map(str, sys.version_info[:2])))
self.assertEqual(platform.python_implementation(), "CPython")
self.assertEqual(platform.system(), "Windows")
self.assertTrue(isinstance(sys.api_version, int) and sys.api_version > 0)