diff -ru Python-3.2/Makefile.orig Python-3.2/Makefile --- Python-3.2/Makefile.orig 2011-06-11 10:06:04 -0700 +++ Python-3.2/Makefile 2011-06-11 09:17:56 -0700 @@ -184,7 +184,7 @@ DYNLOADFILE= dynload_stub.o MACHDEP_OBJS= LIBOBJDIR= Python/ -LIBOBJS= ${LIBOBJDIR}fileblocks$U.o +LIBOBJS= PYTHON= python$(EXE) BUILDPYTHON= python$(BUILDEXE) diff -ru Python-3.2/Modules/config.c.orig Python-3.2/Modules/config.c --- Python-3.2/Modules/config.c.orig 2011-06-11 10:06:04 -0700 +++ Python-3.2/Modules/config.c 2011-06-11 09:03:33 -0700 @@ -27,7 +27,9 @@ extern PyObject* PyInit_signal(void); extern PyObject* PyInit_posix(void); extern PyObject* PyInit_errno(void); +#if !defined(__MINGW32__) extern PyObject* PyInit_pwd(void); +#endif extern PyObject* PyInit__sre(void); extern PyObject* PyInit__codecs(void); extern PyObject* PyInit__weakref(void); @@ -56,7 +58,9 @@ {"signal", PyInit_signal}, {"posix", PyInit_posix}, {"errno", PyInit_errno}, +#if !defined(__MINGW32__) {"pwd", PyInit_pwd}, +#endif {"_sre", PyInit__sre}, {"_codecs", PyInit__codecs}, {"_weakref", PyInit__weakref}, diff -ru Python-3.2/Modules/posixmodule.c.orig Python-3.2/Modules/posixmodule.c --- Python-3.2/Modules/posixmodule.c.orig 2011-06-11 08:13:59 -0700 +++ Python-3.2/Modules/posixmodule.c 2011-06-11 09:42:58 -0700 @@ -135,22 +135,30 @@ #else /* all other compilers */ /* Unix functions that the configure script doesn't check for */ #define HAVE_EXECV 1 +#if !defined(__MINGW32__) #define HAVE_FORK 1 +#endif #if defined(__USLC__) && defined(__SCO_VERSION__) /* SCO UDK Compiler */ #define HAVE_FORK1 1 #endif #define HAVE_GETCWD 1 +#if !defined(__MINGW32__) #define HAVE_GETEGID 1 #define HAVE_GETEUID 1 #define HAVE_GETGID 1 #define HAVE_GETPPID 1 #define HAVE_GETUID 1 #define HAVE_KILL 1 +#endif #define HAVE_OPENDIR 1 +#if !defined(__MINGW32__) #define HAVE_PIPE 1 +#endif #define HAVE_SYSTEM 1 +#if !defined(__MINGW32__) #define HAVE_WAIT 1 #define HAVE_TTYNAME 1 +#endif #endif /* PYOS_OS2 && PYCC_GCC && __VMS */ #endif /* _MSC_VER */ #endif /* __BORLANDC__ */ @@ -2873,7 +2881,7 @@ return NULL; path = PyBytes_AsString(opath); Py_BEGIN_ALLOW_THREADS -#if ( defined(__WATCOMC__) || defined(PYCC_VACPP) ) && !defined(__QNX__) +#if ( defined(__WATCOMC__) || defined(PYCC_VACPP) || defined(__MINGW32__)) && !defined(__QNX__) res = mkdir(path); #else res = mkdir(path, mode); @@ -4125,9 +4133,14 @@ if (slave_fd < 0) return posix_error(); #else +#if !defined(__MINGW32__) master_fd = open(DEV_PTY_FILE, O_RDWR | O_NOCTTY); /* open master */ +#else + master_fd = open(DEV_PTY_FILE, O_RDWR); /* open master */ +#endif if (master_fd < 0) return posix_error(); +#if !defined(__MINGW32__) sig_saved = PyOS_setsig(SIGCHLD, SIG_DFL); /* change permission of slave */ if (grantpt(master_fd) < 0) { @@ -4143,10 +4156,15 @@ slave_name = ptsname(master_fd); /* get name of slave */ if (slave_name == NULL) return posix_error(); +#endif +#if !defined(__MINGW32__) slave_fd = open(slave_name, O_RDWR | O_NOCTTY); /* open slave */ +#else + slave_fd = open(slave_name, O_RDWR); /* open slave */ +#endif if (slave_fd < 0) return posix_error(); -#if !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC) +#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(HAVE_DEV_PTC) ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */ ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */ #ifndef __hpux diff -ru Python-3.2/Modules/pwdmodule.c.orig Python-3.2/Modules/pwdmodule.c --- Python-3.2/Modules/pwdmodule.c.orig 2011-06-11 08:13:59 -0700 +++ Python-3.2/Modules/pwdmodule.c 2011-06-11 09:02:39 -0700 @@ -1,4 +1,4 @@ - +#if !defined(__MINGW32__) /* UNIX password file access module */ #include "Python.h" @@ -220,3 +220,4 @@ PyModule_AddObject(m, "struct_passwd", (PyObject *) &StructPwdType); return m; } +#endif diff -ru Python-3.2//Python/import.c.orig Python-3.2/Python/import.c --- Python-3.2/Python/import.c.orig 2011-06-11 08:14:01 -0700 +++ Python-3.2/Python/import.c 2011-06-11 08:18:20 -0700 @@ -1167,7 +1167,7 @@ FILE *fp; char *dirpath; time_t mtime = srcstat->st_mtime; -#ifdef MS_WINDOWS /* since Windows uses different permissions */ +#if defined(MS_WINDOWS) || defined(__MINGW32__) /* since Windows uses different permissions */ mode_t mode = srcstat->st_mode & ~S_IEXEC; #else mode_t mode = srcstat->st_mode & ~S_IXUSR & ~S_IXGRP & ~S_IXOTH; @@ -1189,7 +1189,7 @@ saved = *dirpath; *dirpath = '\0'; -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__MINGW32__) if (_mkdir(cpathname) < 0 && errno != EEXIST) { #else if (mkdir(cpathname, dirmode) < 0 && errno != EEXIST) { diff -ru Python-3.2/Python/pytime.c.orig Python-3.2/Python/pytime.c --- Python-3.2/Python/pytime.c.orig 2011-06-11 08:14:02 -0700 +++ Python-3.2/Python/pytime.c 2011-06-11 08:19:19 -0700 @@ -14,7 +14,7 @@ #ifdef HAVE_FTIME #include -#if !defined(MS_WINDOWS) && !defined(PYOS_OS2) +#if !defined(MS_WINDOWS) && !defined(__MINGW32__) && !defined(PYOS_OS2) extern int ftime(struct timeb *); #endif /* MS_WINDOWS */ #endif /* HAVE_FTIME */ diff -ru Python-3.2/Python/thread_pthread.h.orig Python-3.2/Python/thread_pthread.h --- Python-3.2/Python/thread_pthread.h.orig 2011-06-11 08:14:05 -0700 +++ Python-3.2/Python/thread_pthread.h 2011-06-11 08:32:46 -0700 @@ -217,8 +217,11 @@ pthread_detach(th); -#if SIZEOF_PTHREAD_T <= SIZEOF_LONG - return (long) th; +#if SIZEOF_PTHREAD_T < SIZEOF_LONG + union {pthread_t th; long l;} u; + u.l = 0; + u.th = th; + return u.l; #else return (long) *(long *) &th; #endif @@ -240,7 +243,10 @@ /* Jump through some hoops for Alpha OSF/1 */ threadid = pthread_self(); #if SIZEOF_PTHREAD_T <= SIZEOF_LONG - return (long) threadid; + union {pthread_t th; long l;} u; + u.l = 0; + u.th = threadid; + return u.l; #else return (long) *(long *) &threadid; #endif