diff -rupN Python-2.7.13/configure.ac Python-2.7.13-new/configure.ac
--- Python-2.7.13/configure.ac 2017-01-21 01:46:04.363630435 +0100
+++ Python-2.7.13-new/configure.ac 2017-01-21 01:46:04.664627221 +0100
@@ -326,6 +326,9 @@ then
*-*-cygwin*)
ac_sys_system=Cygwin
;;
+ *-*-mingw*)
+ ac_sys_system=MinGW
+ ;;
*)
# for now, limit cross builds to known configurations
MACHDEP="unknown"
@@ -353,6 +356,7 @@ then
darwin*) MACHDEP="darwin";;
atheos*) MACHDEP="atheos";;
irix646) MACHDEP="irix6";;
+ mingw*) MACHDEP="win32";;
'') MACHDEP="unknown";;
esac
fi
@@ -372,12 +376,23 @@ if test "$cross_compiling" = yes; then
*-*-cygwin*)
_host_cpu=
;;
+ *-*-mingw*)
+ _host_cpu=
+ ;;
*)
# for now, limit cross builds to known configurations
MACHDEP="unknown"
AC_MSG_ERROR([cross build not supported for $host])
esac
_PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
+
+ case "$host_os" in
+ mingw*)
+ # As sys.platform() return 'win32' to build python and extantions
+ # we will use 'mingw' (in setup.py and etc.)
+ _PYTHON_HOST_PLATFORM=mingw
+ ;;
+ esac
fi
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
diff -rupN Python-2.7.13/Python/getplatform.c Python-2.7.13-new/Python/getplatform.c
--- Python-2.7.13/Python/getplatform.c 2016-12-17 21:05:07.000000000 +0100
+++ Python-2.7.13-new/Python/getplatform.c 2017-01-21 01:46:04.664627221 +0100
@@ -1,6 +1,12 @@
#include "Python.h"
+#ifdef __MINGW32__
+# undef PLATFORM
+/* see PC/pyconfig.h */
+# define PLATFORM "win32"
+#endif
+
#ifndef PLATFORM
#define PLATFORM "unknown"
#endif