Skip to content

Commit e634147

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 1d99821 commit e634147

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

configure.ac

+18-4
Original file line numberDiff line numberDiff line change
@@ -4801,10 +4801,24 @@ then
48014801
esac
48024802
case $host in
48034803
*-*-mingw*)
4804-
DYNLOADFILE="dynload_win.o"
4805-
extra_machdep_objs="$extra_machdep_objs PC/dl_nt.o"
4806-
CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"$VERSION\"' -DPY3_DLLNAME='L\"$DLLLIBRARY\"'"
4807-
;;
4804+
DYNLOADFILE="dynload_win.o"
4805+
extra_machdep_objs="$extra_machdep_objs PC/dl_nt.o"
4806+
CFLAGS_NODIST="$CFLAGS_NODIST -DPY3_DLLNAME='L\"$DLLLIBRARY\"'"
4807+
case $host in
4808+
i686*)
4809+
CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"${VERSION}-32\"'"
4810+
;;
4811+
armv7*)
4812+
CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"${VERSION}-arm32\"'"
4813+
;;
4814+
aarch64*)
4815+
CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"${VERSION}-arm64\"'"
4816+
;;
4817+
*)
4818+
CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"$VERSION\"'"
4819+
;;
4820+
esac
4821+
;;
48084822
esac
48094823
fi
48104824
AC_MSG_RESULT($DYNLOADFILE)

mingw_smoketests.py

+8-1
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)