From e3d46689d881045ceb2dbf31d7d4573709f781d8 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 18 Jul 2010 21:38:09 +0200 Subject: [PATCH] mingw::python: fully support subprocess through PC/_subprocess module. --- gub/specs/python-2-6.py | 2 ++ gub/specs/python.py | 13 ++++++++++--- patches/python-2.4.5-1.patch | 3 ++- patches/python-2.6.4.patch | 3 ++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/gub/specs/python-2-6.py b/gub/specs/python-2-6.py index 68b71e91a..09461a314 100644 --- a/gub/specs/python-2-6.py +++ b/gub/specs/python-2-6.py @@ -42,6 +42,8 @@ class Python_2_6__mingw (python.Python__mingw): 'python-2.4.2-winsock2.patch', 'python-2.4.2-setup.py-selectmodule.patch', 'python-2.4.5-disable-pwd-mingw.patch', + 'python-2.4.5-mingw-site.patch', + 'python-2.4.5-mingw-socketmodule.patch', ] dependencies = [ 'db-devel', diff --git a/gub/specs/python.py b/gub/specs/python.py index 15cd4ab35..8d17cf215 100644 --- a/gub/specs/python.py +++ b/gub/specs/python.py @@ -125,11 +125,18 @@ def __init__ (self, settings, source): # 2.4.2 and combined in one patch; move to cross-Python? def patch (self): Python.patch (self) - ## to make subprocess.py work. self.file_sub ([ - ("import fcntl", ""), + ('(== "win32")', r'in ("win32", "mingw32")'), ], "%(srcdir)s/Lib/subprocess.py", - must_succeed=True) + must_succeed=True) + def configure (self): + Python.configure (self) + self.dump (''' +_subprocess ../PC/_subprocess.c +msvcrt ../PC/msvcrtmodule.c +''', + '%(builddir)s/Modules/Setup', + mode='a') def compile (self): self.system (''' cd %(builddir)s && rm -f python.exe diff --git a/patches/python-2.4.5-1.patch b/patches/python-2.4.5-1.patch index 0e2d0c7ad..3c8032234 100644 --- a/patches/python-2.4.5-1.patch +++ b/patches/python-2.4.5-1.patch @@ -496,12 +496,13 @@ (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) --- python-2.4.5/Modules/posixmodule.c.orig 2008-11-08 16:59:06.000000000 +0100 +++ python-2.4.5/Modules/posixmodule.c 2008-11-08 16:59:59.000000000 +0100 -@@ -118,6 +118,10 @@ corresponding Unix manual entries for mo +@@ -118,6 +118,11 @@ corresponding Unix manual entries for mo #define HAVE_FSYNC 1 #define fsync _commit #else +#ifdef __MINGW32__ /* MINGW32 (cross-)compiler*/ +#define HAVE_FSYNC 1 ++#define HAVE_PIPE 1 +#define fsync _commit +#else #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS) diff --git a/patches/python-2.6.4.patch b/patches/python-2.6.4.patch index 451b47717..b5464a0e7 100644 --- a/patches/python-2.6.4.patch +++ b/patches/python-2.6.4.patch @@ -496,12 +496,13 @@ (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) --- python-2.4.5/Modules/posixmodule.c.orig 2008-11-08 16:59:06.000000000 +0100 +++ python-2.4.5/Modules/posixmodule.c 2008-11-08 16:59:59.000000000 +0100 -@@ -118,6 +118,10 @@ corresponding Unix manual entries for mo +@@ -118,6 +118,11 @@ corresponding Unix manual entries for mo #define HAVE_FSYNC 1 #define fsync _commit #else +#ifdef __MINGW32__ /* MINGW32 (cross-)compiler*/ +#define HAVE_FSYNC 1 ++#define HAVE_PIPE 1 +#define fsync _commit +#else #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS)