Skip to content

Commit 6d632dd

Browse files
naveen521kklazka
authored andcommitted
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 #40
1 parent d34deb3 commit 6d632dd

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

configure.ac

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4797,10 +4797,24 @@ then
47974797
esac
47984798
case $host in
47994799
*-*-mingw*)
4800-
DYNLOADFILE="dynload_win.o"
4801-
extra_machdep_objs="$extra_machdep_objs PC/dl_nt.o"
4802-
CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"$VERSION\"' -DPY3_DLLNAME='L\"$DLLLIBRARY\"'"
4803-
;;
4800+
DYNLOADFILE="dynload_win.o"
4801+
extra_machdep_objs="$extra_machdep_objs PC/dl_nt.o"
4802+
CFLAGS_NODIST="$CFLAGS_NODIST -DPY3_DLLNAME='L\"$DLLLIBRARY\"'"
4803+
case $host in
4804+
i686*)
4805+
CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"${VERSION}-32\"'"
4806+
;;
4807+
armv7*)
4808+
CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"${VERSION}-arm32\"'"
4809+
;;
4810+
aarch64*)
4811+
CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"${VERSION}-arm64\"'"
4812+
;;
4813+
*)
4814+
CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"$VERSION\"'"
4815+
;;
4816+
esac
4817+
;;
48044818
esac
48054819
fi
48064820
AC_MSG_RESULT($DYNLOADFILE)

mingw_smoketests.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,14 @@ def test_platform_things(self):
214214
ext_suffixes = importlib.machinery.EXTENSION_SUFFIXES
215215
self.assertTrue(ext_suffix in ext_suffixes)
216216
self.assertTrue(".pyd" in ext_suffixes)
217-
self.assertEqual(sys.winver, ".".join(map(str, sys.version_info[:2])))
217+
if sysconfig.get_platform().startswith('mingw_i686'):
218+
self.assertEqual(sys.winver, ".".join(map(str, sys.version_info[:2])) + '-32')
219+
elif sysconfig.get_platform().startswith('mingw_aarch64'):
220+
self.assertEqual(sys.winver, ".".join(map(str, sys.version_info[:2])) + '-arm64')
221+
elif sysconfig.get_platform().startswith('mingw_armv7'):
222+
self.assertEqual(sys.winver, ".".join(map(str, sys.version_info[:2])) + '-arm32')
223+
else:
224+
self.assertEqual(sys.winver, ".".join(map(str, sys.version_info[:2])))
218225
self.assertEqual(platform.python_implementation(), "CPython")
219226
self.assertEqual(platform.system(), "Windows")
220227
self.assertTrue(isinstance(sys.api_version, int) and sys.api_version > 0)

0 commit comments

Comments
 (0)