MINGW-packages/mingw-w64-python/0069-Modify-sys.winver-to-match-upstream.patch
2025-10-10 14:31:04 +02:00

70 lines
2.8 KiB
Diff

From 12dd8cedd47e2147df10a7b9bb222743b0d82458 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 069/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 ec3962e..e8d63cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5141,10 +5141,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 @@ class Tests(unittest.TestCase):
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)