diff -ru misc/Python-2.7.14/Include/pyport.h misc/build/Python-2.7.14/Include/pyport.h --- misc/Python-2.7.14/Include/pyport.h 2016-06-25 16:49:30.000000000 -0500 +++ misc/build/Python-2.7.14/Include/pyport.h 2016-09-02 16:42:21.498048000 -0500 @@ -9,6 +9,30 @@ #include #endif +#if defined(__MINGW32__) +#undef HAVE_FORKPTY +#undef HAVE_OPENPTY +#undef HAVE_DEV_PTMX +#undef _POSIX_THREADS +#undef HAVE_PTHREAD_H +#define MS_WINDOWS +#define MS_WIN32 +#define Py_WIN_WIDE_FILENAMES +#ifndef PYTHONPATH +# define PYTHONPATH ".\\lib;.\\lib\\python" VERSION ";.\\lib\\python" VERSION "\\lib-dynload;.\\lib\\python" VERSION "\\plat-winmingw32;.\\lib\\python" VERSION "\\lib-tk" +#endif +#define NT_THREADS +#define WITH_THREAD +#define WINVER 0x0501 +#ifdef socklen_t +#undef socklen_t +#endif +#define HAVE_ADDRINFO +#define HAVE_GETADDRINFO +#define HAVE_GETNAMEINFO +#define HAVE_GETPEERNAME +#endif + #ifdef HAVE_STDINT_H #include #endif diff -ru misc/Python-2.7.14/Lib/distutils/ccompiler.py misc/build/Python-2.7.14/Lib/distutils/ccompiler.py --- misc/Python-2.7.14/Lib/distutils/ccompiler.py 2016-06-25 16:49:30.000000000 -0500 +++ misc/build/Python-2.7.14/Lib/distutils/ccompiler.py 2016-09-02 16:42:21.499097000 -0500 @@ -896,6 +896,7 @@ # on a cygwin built python we can use gcc like an ordinary UNIXish # compiler ('cygwin.*', 'unix'), + ('winmingw*', 'unix'), ('os2emx', 'emx'), # OS name mappings diff -ru misc/Python-2.7.14/Lib/distutils/command/build_ext.py misc/build/Python-2.7.14/Lib/distutils/command/build_ext.py --- misc/Python-2.7.14/Lib/distutils/command/build_ext.py 2016-06-25 16:49:30.000000000 -0500 +++ misc/build/Python-2.7.14/Lib/distutils/command/build_ext.py 2016-09-02 16:42:21.499914000 -0500 @@ -224,7 +224,7 @@ # for extensions under Cygwin and AtheOS Python's library directory must be # appended to library_dirs - if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos': + if sys.platform[:6] == 'cygwin' or sys.platform[:8] == 'winmingw' or sys.platform[:6] == 'atheos': if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")): # building third party extensions self.library_dirs.append(os.path.join(sys.prefix, "lib", @@ -726,7 +726,7 @@ # don't extend ext.libraries, it may be shared with other # extensions, it is a reference to the original list return ext.libraries + [pythonlib] - elif sys.platform[:6] == "cygwin": + elif sys.platform[:6] == "cygwin" or sys.platform[:8] == "winmingw": template = "python%d.%d" pythonlib = (template % (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) diff -ru misc/Python-2.7.14/Lib/distutils/command/install.py misc/build/Python-2.7.14/Lib/distutils/command/install.py --- misc/Python-2.7.14/Lib/distutils/command/install.py 2016-06-25 16:49:30.000000000 -0500 +++ misc/build/Python-2.7.14/Lib/distutils/command/install.py 2016-09-02 16:42:21.500659000 -0500 @@ -348,9 +348,10 @@ # Convert directories from Unix /-separated syntax to the local # convention. - self.convert_paths('lib', 'purelib', 'platlib', - 'scripts', 'data', 'headers', - 'userbase', 'usersite') + if os.sep != '/': + self.convert_paths('lib', 'purelib', 'platlib', + 'scripts', 'data', 'headers', + 'userbase', 'usersite') # Well, we're not actually fully completely finalized yet: we still # have to deal with 'extra_path', which is the hack for allowing @@ -362,7 +363,7 @@ # If a new root directory was supplied, make all the installation # dirs relative to it. - if self.root is not None: + if self.root is not None and self.root != "": self.change_roots('libbase', 'lib', 'purelib', 'platlib', 'scripts', 'data', 'headers') @@ -501,7 +502,10 @@ def convert_paths (self, *names): for name in names: attr = "install_" + name - setattr(self, attr, convert_path(getattr(self, attr))) + if self.root is None or self.root == "": + setattr(self, attr, getattr(self, attr).replace('/', os.sep)) + else: + setattr(self, attr, convert_path(getattr(self, attr))) def handle_extra_path (self): diff -ru misc/Python-2.7.14/Lib/distutils/spawn.py misc/build/Python-2.7.14/Lib/distutils/spawn.py --- misc/Python-2.7.14/Lib/distutils/spawn.py 2016-06-25 16:49:30.000000000 -0500 +++ misc/build/Python-2.7.14/Lib/distutils/spawn.py 2016-09-02 16:42:21.501126000 -0500 @@ -212,7 +212,7 @@ paths = path.split(os.pathsep) base, ext = os.path.splitext(executable) - if (sys.platform == 'win32' or os.name == 'os2') and (ext != '.exe'): + if (sys.platform == 'win32' or sys.platform[:8] == "winmingw" or os.name == 'os2') and (ext != '.exe'): executable = executable + '.exe' if not os.path.isfile(executable): diff -ru misc/Python-2.7.14/Lib/distutils/sysconfig.py misc/build/Python-2.7.14/Lib/distutils/sysconfig.py --- misc/Python-2.7.14/Lib/distutils/sysconfig.py 2016-06-25 16:49:30.000000000 -0500 +++ misc/build/Python-2.7.14/Lib/distutils/sysconfig.py 2016-09-02 16:42:21.501681000 -0500 @@ -450,6 +450,9 @@ global _config_vars if _config_vars is None: func = globals().get("_init_" + os.name) + if sys.platform[:8] == "winmingw": + func = globals().get("_init_posix") + if func: func() else: diff -ru misc/Python-2.7.14/Lib/distutils/unixccompiler.py misc/build/Python-2.7.14/Lib/distutils/unixccompiler.py --- misc/Python-2.7.14/Lib/distutils/unixccompiler.py 2016-06-25 16:49:30.000000000 -0500 +++ misc/build/Python-2.7.14/Lib/distutils/unixccompiler.py 2016-09-02 16:44:54.962041000 -0500 @@ -82,7 +82,7 @@ xcode_stub_lib_extension = ".tbd" static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s" xcode_stub_lib_format = dylib_lib_format - if sys.platform == "cygwin": + if sys.platform == "cygwin" or sys.platform == "winmingw": exe_extension = ".exe" def preprocess(self, source, diff -ru misc/Python-2.7.14/Lib/os.py misc/build/Python-2.7.14/Lib/os.py --- misc/Python-2.7.14/Lib/os.py 2016-06-25 16:49:31.000000000 -0500 +++ misc/build/Python-2.7.14/Lib/os.py 2016-09-02 16:42:21.503786000 -0500 @@ -38,7 +38,21 @@ except AttributeError: return [n for n in dir(module) if n[0] != '_'] -if 'posix' in _names: +if 'winmingw32' in _names: + name = 'nt' + linesep = '\r\n' + from posix import * + try: + from posix import _exit + except ImportError: + pass + import ntpath as path + + import posix + __all__.extend(_get_exports_list(posix)) + del posix + +elif 'posix' in _names: name = 'posix' linesep = '\n' from posix import * diff -ru misc/Python-2.7.14/Lib/socket.py misc/build/Python-2.7.14/Lib/socket.py --- misc/Python-2.7.14/Lib/socket.py 2016-06-25 16:49:31.000000000 -0500 +++ misc/build/Python-2.7.14/Lib/socket.py 2016-09-02 16:42:21.504874000 -0500 @@ -157,7 +157,7 @@ 'sendall', 'setblocking', 'settimeout', 'gettimeout', 'shutdown') -if os.name == "nt": +if os.name == "nt" and sys.platform[:8] != "winmingw": _socketmethods = _socketmethods + ('ioctl',) if sys.platform == "riscos": diff -ru misc/Python-2.7.14/Makefile.pre.in misc/build/Python-2.7.14/Makefile.pre.in --- misc/Python-2.7.14/Makefile.pre.in 2016-06-25 16:49:31.000000000 -0500 +++ misc/build/Python-2.7.14/Makefile.pre.in 2016-09-02 16:42:21.506300000 -0500 @@ -125,6 +125,16 @@ BLDSHARED= @BLDSHARED@ $(LDFLAGS) LDCXXSHARED= @LDCXXSHARED@ DESTSHARED= $(BINLIBDEST)/lib-dynload +ifeq (@MACHDEP@,winmingw32) +DESTSHAREDFORRULES= $(shell cd $(DESTSHARED) && pwd || echo DESTSHARED) +LIBPYTHONPATH= $(shell cd $(DESTDIR)$(LIBDEST) && cmd /c cd | sed -e s:\\\\:/:g) +DESTPYTHONPATH= $(LIBPYTHONPATH);$(shell cd $(DESTDIR)$(DESTSHARED) && cmd /c cd | sed -e s:\\\\:/:g) +LIBDESTPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(LIBDEST) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(LIBDEST) ; fi) +PREFIXPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(prefix) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(prefix) ; fi) +BINDIRPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(BINDIR) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(BINDIR) ; fi) +DESTSHAREDPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(DESTSHARED) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(DESTSHARED) ; fi) +DESTDIRPARAM= $(shell if test ! -z "$(DESTDIR)" ; then cd $(DESTDIR) && cmd /c | sed -e s:\\\\:/:g ; fi) +endif # Executable suffix (.exe on Windows and Mac OS X) EXE= @EXEEXT@ @@ -225,7 +235,7 @@ # Modules MODULE_OBJS= \ Modules/config.o \ - Modules/getpath.o \ + @GETPATH_OBJS@ \ Modules/main.o \ Modules/gcmodule.o @@ -646,6 +656,10 @@ -DVPATH='"$(VPATH)"' \ -o $@ $(srcdir)/Modules/getpath.c +PC/getpathp.o: $(srcdir)/PC/getpathp.c Makefile + $(CC) -c $(PY_CFLAGS) -DVERSION='"$(VERSION)"' \ + -o $@ $(srcdir)/PC/getpathp.c + Modules/python.o: $(srcdir)/Modules/python.c $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c @@ -700,6 +714,12 @@ Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \ $(srcdir)/Objects/unicodetype_db.h +Objects/exceptions.o: $(srcdir)/Objects/exceptions.c + $(CC) -c $(PY_CFLAGS) -I$(srcdir)/PC -o $@ $(srcdir)/Objects/exceptions.c + +PC/import_nt.o: $(srcdir)/PC/import_nt.c + $(CC) -c $(PY_CFLAGS) -I$(srcdir)/Python -o $@ $(srcdir)/PC/import_nt.c + STRINGLIB_HEADERS= \ $(srcdir)/Include/bytes_methods.h \ $(srcdir)/Objects/stringlib/count.h \ @@ -928,7 +948,11 @@ # Install shared libraries enabled by Setup DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED) +ifeq (@MACHDEP@,winmingw32) +oldsharedinstall: $(DESTSHAREDFORRULES) $(SHAREDMODS) +else oldsharedinstall: $(DESTSHARED) $(SHAREDMODS) +endif @for i in X $(SHAREDMODS); do \ if test $$i != X; then \ echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \ @@ -936,7 +960,11 @@ fi; \ done +ifeq (@MACHDEP@,winmingw32) +$(DESTSHAREDFORRULES): +else $(DESTSHARED): +endif @for i in $(DESTDIRS); \ do \ if test ! -d $(DESTDIR)$$i; then \ @@ -1054,7 +1082,11 @@ unittest unittest/test \ lib-old \ curses pydoc_data $(MACHDEPS) +ifeq (@MACHDEP@,winmingw32) +libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c sharedinstall +else libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c +endif @for i in $(SCRIPTDIR) $(LIBDEST); \ do \ if test ! -d $(DESTDIR)$$i; then \ @@ -1114,6 +1082,26 @@ $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ $(DESTDIR)$(LIBDEST)/distutils/tests ; \ fi +ifeq (@MACHDEP@,winmingw32) + PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \ + ./$(BUILDPYTHON) -Wi -tt $(LIBPYTHONPATH)/compileall.py \ + -d $(LIBDESTPARAM) -f \ + -x 'bad_coding|badsyntax|site-packages' $(LIBPYTHONPATH) + PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \ + ./$(BUILDPYTHON) -Wi -tt -O $(LIBPYTHONPATH)/compileall.py \ + -d $(LIBDESTPARAM) -f \ + -x 'bad_coding|badsyntax|site-packages' $(LIBPYTHONPATH) + -PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \ + ./$(BUILDPYTHON) -Wi -t $(LIBPYTHONPATH)/compileall.py \ + -d $(LIBDESTPARAM)/site-packages -f \ + -x badsyntax $(LIBPYTHONPATH)/site-packages + -PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \ + ./$(BUILDPYTHON) -Wi -t -O $(LIBPYTHONPATH)/compileall.py \ + -d $(LIBDESTPARAM)/site-packages -f \ + -x badsyntax $(LIBPYTHONPATH)/site-packages + -PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \ + ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" +else PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ -d $(LIBDEST) -f \ @@ -1140,6 +1190,7 @@ # Create the PLATDIR source directory, if one wasn't distributed.. $(srcdir)/Lib/$(PLATDIR): mkdir $(srcdir)/Lib/$(PLATDIR) +ifneq (@MACHDEP@,winmingw32) cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen export PATH; PATH="`pwd`:$$PATH"; \ export PYTHONPATH; PYTHONPATH="$(srcdir)/Lib:$(abs_builddir)/`cat pybuilddir.txt`"; \ @@ -1153,6 +1207,7 @@ PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)"; \ fi; \ cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen +endif python-config: $(srcdir)/Misc/python-config.in # Substitution happens here, as the completely-expanded BINDIR @@ -1246,6 +1300,15 @@ # Install the dynamically loadable modules # This goes into $(exec_prefix) +ifeq (@MACHDEP@,winmingw32) +sharedinstall: $(DESTSHAREDFORRULES) + $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ + --prefix=$(PREFIXPARAM) \ + --install-scripts=$(BINDIRPARAM) \ + --install-platlib=$(DESTSHAREDPARAM) \ + --root=$(DESTDIRPARAM) +else + sharedinstall: sharedmods $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ --prefix=$(prefix) \ @@ -1253,6 +1316,7 @@ --install-platlib=$(DESTSHARED) \ --root=$(DESTDIR)/ -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py* +endif # Here are a couple of targets for MacOSX again, to install a full # framework-based Python. frameworkinstall installs everything, the diff -ru misc/Python-2.7.14/Modules/Setup.config.in misc/build/Python-2.7.14/Modules/Setup.config.in --- misc/Python-2.7.14/Modules/Setup.config.in 2016-06-25 16:49:31.000000000 -0500 +++ misc/build/Python-2.7.14/Modules/Setup.config.in 2016-09-02 16:42:21.507091000 -0500 @@ -9,5 +9,9 @@ # The signal module @USE_SIGNAL_MODULE@signal signalmodule.c +# The password module +@USE_PASSWORD_MODULE@pwd pwdmodule.c # this is needed to find out the user's home dir + # if $HOME is not set + # The rest of the modules previously listed in this file are built # by the setup.py script in Python 2.1 and later. diff -ru misc/Python-2.7.14/Modules/Setup.dist misc/build/Python-2.7.14/Modules/Setup.dist --- misc/Python-2.7.14/Modules/Setup.dist 2016-06-25 16:49:31.000000000 -0500 +++ misc/build/Python-2.7.14/Modules/Setup.dist 2016-09-02 16:42:21.507936000 -0500 @@ -114,7 +114,7 @@ posix posixmodule.c # posix (UNIX) system calls errno errnomodule.c # posix (UNIX) errno values -pwd pwdmodule.c # this is needed to find out the user's home dir +#pwd pwdmodule.c # this is needed to find out the user's home dir # if $HOME is not set _sre _sre.c # Fredrik Lundh's new regular expressions _codecs _codecsmodule.c # access to the builtin codecs and codec registry diff -ru misc/Python-2.7.14/Modules/_ctypes/libffi/configure misc/build/Python-2.7.14/Modules/_ctypes/libffi/configure --- misc/Python-2.7.14/Modules/_ctypes/libffi/configure 2016-06-25 16:49:31.000000000 -0500 +++ misc/build/Python-2.7.14/Modules/_ctypes/libffi/configure 2016-09-02 16:42:21.516830000 -0500 @@ -18807,6 +18807,12 @@ fi +case $host_os in +mingw*) + srcdir=`cd $srcdir && cmd /c cd | sed -e 's:\\\\:/:g'` + ;; +esac + ac_config_commands="$ac_config_commands include" ac_config_commands="$ac_config_commands src" diff -ru misc/Python-2.7.14/Modules/_ctypes/libffi/configure.ac misc/build/Python-2.7.14/Modules/_ctypes/libffi/configure.ac --- misc/Python-2.7.14/Modules/_ctypes/libffi/configure.ac 2016-06-25 16:49:31.000000000 -0500 +++ misc/build/Python-2.7.14/Modules/_ctypes/libffi/configure.ac 2016-09-02 16:42:21.517727000 -0500 @@ -613,6 +613,12 @@ fi AC_SUBST(toolexeclibdir) +case $host_os in +mingw*) + srcdir=`cd $srcdir && cmd /c cd | sed -e 's:\\\\:/:g'` + ;; +esac + AC_CONFIG_COMMANDS(include, [test -d include || mkdir include]) AC_CONFIG_COMMANDS(src, [ test -d src || mkdir src diff -ru misc/Python-2.7.14/Modules/_ctypes/libffi/include/ffi.h.in misc/build/Python-2.7.14/Modules/_ctypes/libffi/include/ffi.h.in --- misc/Python-2.7.14/Modules/_ctypes/libffi/include/ffi.h.in 2016-06-25 16:49:31.000000000 -0500 +++ misc/build/Python-2.7.14/Modules/_ctypes/libffi/include/ffi.h.in 2016-09-02 16:42:21.518314000 -0500 @@ -433,7 +433,11 @@ ffi_type *rtype, ffi_type **atypes); +#ifdef MS_WIN32 +int ffi_call(ffi_cif *cif, +#else void ffi_call(ffi_cif *cif, +#endif void (*fn)(void), void *rvalue, void **avalue); diff -ru misc/Python-2.7.14/Modules/config.c.in misc/build/Python-2.7.14/Modules/config.c.in --- misc/Python-2.7.14/Modules/config.c.in 2016-06-25 16:49:31.000000000 -0500 +++ misc/build/Python-2.7.14/Modules/config.c.in 2016-09-02 16:42:21.518926000 -0500 @@ -48,6 +48,9 @@ {"__builtin__", NULL}, {"sys", NULL}, {"exceptions", NULL}, +#ifdef __MINGW32__ + {"winmingw32", NULL}, +#endif /* This lives in gcmodule.c */ {"gc", initgc}, diff -ru misc/Python-2.7.14/Modules/posixmodule.c misc/build/Python-2.7.14/Modules/posixmodule.c --- misc/Python-2.7.14/Modules/posixmodule.c 2016-06-25 16:49:31.000000000 -0500 +++ misc/build/Python-2.7.14/Modules/posixmodule.c 2016-09-02 16:42:21.523456000 -0500 @@ -132,6 +132,15 @@ #define HAVE_FSYNC 1 #define fsync _commit #else +#ifdef __MINGW32__ +#define HAVE_SPAWNV 1 +#define HAVE_EXECV 1 +#define HAVE_GETCWD 1 +#define HAVE_OPENDIR 1 +#define HAVE_PIPE 1 +#define HAVE_POPEN 1 +#define HAVE_SYSTEM 1 +#else #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS) /* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */ #else /* all other compilers */ @@ -157,6 +166,7 @@ #define HAVE_WAIT 1 #define HAVE_TTYNAME 1 #endif /* PYOS_OS2 && PYCC_GCC && __VMS */ +#endif /* __MINGW32__ */ #endif /* _MSC_VER */ #endif /* __BORLANDC__ */ #endif /* ! __WATCOMC__ || __QNX__ */ @@ -277,6 +287,14 @@ #define pclose _pclose #endif /* _MSC_VER */ +#ifdef __MINGW32__ +#include "osdefs.h" +#include +#include /* for ShellExecute() */ +#define popen _popen +#define pclose _pclose +#endif + #if defined(PYCC_VACPP) && defined(PYOS_OS2) #include #endif /* OS2 */ @@ -630,7 +648,7 @@ */ #include static char **environ; -#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) ) +#elif !defined(_MSC_VER) && !defined(__MINGW32__) && ( !defined(__WATCOMC__) || defined(__QNX__) ) extern char **environ; #endif /* !_MSC_VER */ @@ -1049,7 +1067,7 @@ int st_ctime_nsec; }; -static __int64 secs_between_epochs = 11644473600; /* Seconds between 1.1.1601 and 1.1.1970 */ +static __int64 secs_between_epochs = 11644473600LL; /* Seconds between 1.1.1601 and 1.1.1970 */ static void FILE_TIME_to_time_t_nsec(FILETIME *in_ptr, time_t *time_out, int* nsec_out) @@ -1568,7 +1586,7 @@ return v; } -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) && !defined(__MINGW32__) /* IsUNCRoot -- test whether the supplied path is of the form \\SERVER\SHARE\, where / can be used in place of \ and the trailing slash is optional. diff -ru misc/Python-2.7.14/Modules/socketmodule.c misc/build/Python-2.7.14/Modules/socketmodule.c --- misc/Python-2.7.14/Modules/socketmodule.c 2016-06-25 16:49:31.000000000 -0500 +++ misc/build/Python-2.7.14/Modules/socketmodule.c 2016-09-02 16:42:21.526595000 -0500 @@ -341,7 +341,7 @@ /* Do not include addrinfo.h for MSVC7 or greater. 'addrinfo' and * EAI_* constants are defined in (the already included) ws2tcpip.h. */ -#else +#elif !defined(__MINGW32__) # include "addrinfo.h" #endif diff -ru misc/Python-2.7.14/PC/_winreg.c misc/build/Python-2.7.14/PC/_winreg.c --- misc/Python-2.7.14/PC/_winreg.c 2016-06-25 16:49:32.000000000 -0500 +++ misc/build/Python-2.7.14/PC/_winreg.c 2016-09-02 16:42:21.528227000 -0500 @@ -1792,6 +1792,9 @@ } #define ADD_KEY(val) inskey(d, #val, val) +#ifndef REG_LEGAL_CHANGE_FILTER +#define REG_LEGAL_CHANGE_FILTER (REG_NOTIFY_CHANGE_NAME|REG_NOTIFY_CHANGE_ATTRIBUTES|REG_NOTIFY_CHANGE_LAST_SET|REG_NOTIFY_CHANGE_SECURITY) +#endif PyMODINIT_FUNC init_winreg(void) { diff -ru misc/Python-2.7.14/Python/dynload_win.c misc/build/Python-2.7.14/Python/dynload_win.c --- misc/Python-2.7.14/Python/dynload_win.c 2016-06-25 16:49:32.000000000 -0500 +++ misc/build/Python-2.7.14/Python/dynload_win.c 2016-09-02 16:42:21.528984000 -0500 @@ -28,6 +28,7 @@ /* Case insensitive string compare, to avoid any dependencies on particular C RTL implementations */ +#ifndef __MINGW32__ static int strcasecmp (char *string1, char *string2) { int first, second; @@ -41,6 +42,7 @@ return (first - second); } +#endif /* Function to return the name of the "python" DLL that the supplied module diff -ru misc/Python-2.7.14/Python/frozenmain.c misc/build/Python-2.7.14/Python/frozenmain.c --- misc/Python-2.7.14/Python/frozenmain.c 2016-06-25 16:49:32.000000000 -0500 +++ misc/build/Python-2.7.14/Python/frozenmain.c 2016-09-02 16:46:11.594746000 -0500 @@ -3,7 +3,7 @@ #include "Python.h" -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) && !defined(__MINGW32__) extern void PyWinFreeze_ExeInit(void); extern void PyWinFreeze_ExeTerm(void); extern int PyInitFrozenExtensions(void); @@ -32,13 +32,13 @@ setbuf(stderr, (char *)NULL); } -#ifdef MS_WINDOWS +#ifdef MS_WINDOWS && !defined(__MINGW32__) PyInitFrozenExtensions(); #endif /* MS_WINDOWS */ if (argc >= 1) Py_SetProgramName(argv[0]); Py_Initialize(); -#ifdef MS_WINDOWS +#ifdef MS_WINDOWS && !defined(__MINGW32__) PyWinFreeze_ExeInit(); #endif @@ -61,7 +61,7 @@ if (inspect && isatty((int)fileno(stdin))) sts = PyRun_AnyFile(stdin, "") != 0; -#ifdef MS_WINDOWS +#ifdef MS_WINDOWS && !defined(__MINGW32__) PyWinFreeze_ExeTerm(); #endif Py_Finalize(); Only in misc/build/Python-2.7.14/Python: frozenmain.c.rej