Skip to content

Commit

Permalink
Modify sys.winver to match upstream
Browse files Browse the repository at this point in the history
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
  • Loading branch information
naveen521kk authored and lazka committed Aug 25, 2023
1 parent 1d99821 commit e634147
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
22 changes: 18 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4801,10 +4801,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)
Expand Down
9 changes: 8 additions & 1 deletion mingw_smoketests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e634147

Please sign in to comment.