1 --- misc/Python-2.6.1/Include/pyport.h 2008-06-11 16:41:16.000000000 +0900
2 +++ misc/build/Python-2.6.1/Include/pyport.h 2009-03-29 23:28:13.859000000 +0900
5 #include "pyconfig.h" /* include for defines */
7 +#if defined(__MINGW32__)
11 +#undef _POSIX_THREADS
12 +#undef HAVE_PTHREAD_H
15 +#define Py_WIN_WIDE_FILENAMES
17 +# define PYTHONPATH ".\\lib;.\\lib\\python" VERSION ";.\\lib\\python" VERSION "\\lib-dynload;.\\lib\\python" VERSION "\\plat-winmingw32;.\\lib\\python" VERSION "\\lib-tk"
21 +#define WINVER 0x0501
25 +#define HAVE_ADDRINFO
26 +#define HAVE_GETADDRINFO
27 +#define HAVE_GETNAMEINFO
28 +#define HAVE_GETPEERNAME
34 --- misc/Python-2.6.1/Lib/distutils/ccompiler.py 2008-02-22 03:18:37.000000000 +0900
35 +++ misc/build/Python-2.6.1/Lib/distutils/ccompiler.py 2009-04-04 01:00:37.014250000 +0900
37 # on a cygwin built python we can use gcc like an ordinary UNIXish
40 + ('winmingw*', 'unix'),
44 --- misc/Python-2.6.1/Lib/distutils/command/build_ext.py 2008-08-17 13:16:04.000000000 +0900
45 +++ misc/build/Python-2.6.1/Lib/distutils/command/build_ext.py 2009-04-04 01:05:32.311125000 +0900
48 # for extensions under Cygwin and AtheOS Python's library directory must be
49 # appended to library_dirs
50 - if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos':
51 + if sys.platform[:6] == 'cygwin' or sys.platform[:8] == 'winmingw' or sys.platform[:6] == 'atheos':
52 if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
53 # building third party extensions
54 self.library_dirs.append(os.path.join(sys.prefix, "lib",
56 # don't extend ext.libraries, it may be shared with other
57 # extensions, it is a reference to the original list
58 return ext.libraries + [pythonlib]
59 - elif sys.platform[:6] == "cygwin":
60 + elif sys.platform[:6] == "cygwin" or sys.platform[:8] == "winmingw":
61 template = "python%d.%d"
62 pythonlib = (template %
63 (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff))
64 --- misc/Python-2.6.1/Lib/distutils/command/install.py 2008-05-07 07:41:46.000000000 +0900
65 +++ misc/build/Python-2.6.1/Lib/distutils/command/install.py 2009-04-05 23:15:56.540750000 +0900
68 # Convert directories from Unix /-separated syntax to the local
70 - self.convert_paths('lib', 'purelib', 'platlib',
71 - 'scripts', 'data', 'headers',
72 - 'userbase', 'usersite')
74 + self.convert_paths('lib', 'purelib', 'platlib',
75 + 'scripts', 'data', 'headers',
76 + 'userbase', 'usersite')
78 # Well, we're not actually fully completely finalized yet: we still
79 # have to deal with 'extra_path', which is the hack for allowing
82 # If a new root directory was supplied, make all the installation
83 # dirs relative to it.
84 - if self.root is not None:
85 + if self.root is not None and self.root != "":
86 self.change_roots('libbase', 'lib', 'purelib', 'platlib',
87 'scripts', 'data', 'headers')
90 def convert_paths (self, *names):
92 attr = "install_" + name
93 - setattr(self, attr, convert_path(getattr(self, attr)))
94 + if self.root is None or self.root == "":
95 + setattr(self, attr, getattr(self, attr).replace('/', os.sep))
97 + setattr(self, attr, convert_path(getattr(self, attr)))
100 def handle_extra_path (self):
101 --- misc/Python-2.6.1/Lib/distutils/spawn.py 2004-11-11 07:23:15.000000000 +0900
102 +++ misc/build/Python-2.6.1/Lib/distutils/spawn.py 2009-03-22 19:38:32.935625000 +0900
104 path = os.environ['PATH']
105 paths = string.split(path, os.pathsep)
106 (base, ext) = os.path.splitext(executable)
107 - if (sys.platform == 'win32' or os.name == 'os2') and (ext != '.exe'):
108 + if (sys.platform == 'win32' or sys.platform[:8] == "winmingw" or os.name == 'os2') and (ext != '.exe'):
109 executable = executable + '.exe'
110 if not os.path.isfile(executable):
112 --- misc/Python-2.6.1/Lib/distutils/sysconfig.py 2008-06-05 21:58:24.000000000 +0900
113 +++ misc/build/Python-2.6.1/Lib/distutils/sysconfig.py 2009-03-29 10:56:10.965750000 +0900
116 raise DistutilsPlatformError(my_msg)
118 + if sys.platform[:8] == "winmingw":
121 # On MacOSX we need to check the setting of the environment variable
122 # MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so
123 # it needs to be compatible.
126 if _config_vars is None:
127 func = globals().get("_init_" + os.name)
128 + if sys.platform[:8] == "winmingw":
129 + func = globals().get("_init_posix")
134 --- misc/Python-2.6.1/Lib/distutils/unixccompiler.py 2008-07-16 22:24:06.000000000 +0900
135 +++ misc/build/Python-2.6.1/Lib/distutils/unixccompiler.py 2009-04-04 01:11:18.420500000 +0900
137 shared_lib_extension = ".so"
138 dylib_lib_extension = ".dylib"
139 static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s"
140 - if sys.platform == "cygwin":
141 + if sys.platform == "cygwin" or sys.platform == "winmingw":
142 exe_extension = ".exe"
144 def preprocess(self, source,
145 --- misc/Python-2.6.1/Lib/os.py 2008-09-02 14:36:11.000000000 +0900
146 +++ misc/build/Python-2.6.1/Lib/os.py 2009-03-22 16:55:18.356375000 +0900
148 except AttributeError:
149 return [n for n in dir(module) if n[0] != '_']
151 -if 'posix' in _names:
152 +if 'winmingw32' in _names:
155 + from posix import *
157 + from posix import _exit
158 + except ImportError:
160 + import ntpath as path
163 + __all__.extend(_get_exports_list(posix))
166 +elif 'posix' in _names:
170 --- misc/Python-2.6.1/Lib/socket.py 2008-08-08 13:27:28.000000000 +0900
171 +++ misc/build/Python-2.6.1/Lib/socket.py 2009-04-02 00:40:46.941750000 +0900
173 'sendall', 'setblocking',
174 'settimeout', 'gettimeout', 'shutdown')
177 +if os.name == "nt" and sys.platform[:8] != "winmingw":
178 _socketmethods = _socketmethods + ('ioctl',)
180 if sys.platform == "riscos":
181 --- misc/Python-2.6.1/Makefile.pre.in 2008-10-22 01:48:37.000000000 +0900
182 +++ misc/build/Python-2.6.1/Makefile.pre.in 2009-04-08 23:38:27.989250000 +0900
185 BLDSHARED= @BLDSHARED@
186 DESTSHARED= $(BINLIBDEST)/lib-dynload
187 +ifeq (@MACHDEP@,winmingw32)
188 +DESTSHAREDFORRULES= $(shell cd $(DESTSHARED) && pwd || echo DESTSHARED)
189 +LIBPYTHONPATH= $(shell cd $(DESTDIR)$(LIBDEST) && cmd /c cd | sed -e s:\\\\:/:g)
190 +DESTPYTHONPATH= $(LIBPYTHONPATH);$(shell cd $(DESTDIR)$(DESTSHARED) && cmd /c cd | sed -e s:\\\\:/:g)
191 +LIBDESTPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(LIBDEST) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(LIBDEST) ; fi)
192 +PREFIXPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(prefix) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(prefix) ; fi)
193 +BINDIRPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(BINDIR) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(BINDIR) ; fi)
194 +DESTSHAREDPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(DESTSHARED) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(DESTSHARED) ; fi)
195 +DESTDIRPARAM= $(shell if test ! -z "$(DESTDIR)" ; then cd $(DESTDIR) && cmd /c | sed -e s:\\\\:/:g ; fi)
198 # Executable suffix (.exe on Windows and Mac OS X)
204 - Modules/getpath.o \
210 -DVPATH='"$(VPATH)"' \
211 -o $@ $(srcdir)/Modules/getpath.c
213 +PC/getpathp.o: $(srcdir)/PC/getpathp.c Makefile
214 + $(CC) -c $(PY_CFLAGS) -DVERSION='"$(VERSION)"' \
215 + -o $@ $(srcdir)/PC/getpathp.c
217 Modules/python.o: $(srcdir)/Modules/python.c
218 $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
221 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
222 $(srcdir)/Objects/unicodetype_db.h
224 +Objects/exceptions.o: $(srcdir)/Objects/exceptions.c
225 + $(CC) -c $(PY_CFLAGS) -I$(srcdir)/PC -o $@ $(srcdir)/Objects/exceptions.c
227 +PC/import_nt.o: $(srcdir)/PC/import_nt.c
228 + $(CC) -c $(PY_CFLAGS) -I$(srcdir)/Python -o $@ $(srcdir)/PC/import_nt.c
231 $(srcdir)/Include/bytes_methods.h \
232 $(srcdir)/Objects/stringlib/count.h \
234 # Install shared libraries enabled by Setup
235 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
237 +ifeq (@MACHDEP@,winmingw32)
238 +oldsharedinstall: $(DESTSHAREDFORRULES) $(SHAREDMODS)
240 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
242 @for i in X $(SHAREDMODS); do \
243 if test $$i != X; then \
244 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
249 +ifeq (@MACHDEP@,winmingw32)
250 +$(DESTSHAREDFORRULES):
254 @for i in $(DESTDIRS); \
256 if test ! -d $(DESTDIR)$$i; then \
258 multiprocessing multiprocessing/dummy \
261 +ifeq (@MACHDEP@,winmingw32)
262 +libinstall: build_all $(srcdir)/Lib/$(PLATDIR) sharedinstall
264 libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
266 @for i in $(SCRIPTDIR) $(LIBDEST); \
268 if test ! -d $(DESTDIR)$$i; then \
272 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
273 +ifeq (@MACHDEP@,winmingw32)
274 + PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
275 + ./$(BUILDPYTHON) -Wi -tt $(LIBPYTHONPATH)/compileall.py \
276 + -d $(LIBDESTPARAM) -f \
277 + -x 'bad_coding|badsyntax|site-packages' $(LIBPYTHONPATH)
278 + PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
279 + ./$(BUILDPYTHON) -Wi -tt -O $(LIBPYTHONPATH)/compileall.py \
280 + -d $(LIBDESTPARAM) -f \
281 + -x 'bad_coding|badsyntax|site-packages' $(LIBPYTHONPATH)
282 + -PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
283 + ./$(BUILDPYTHON) -Wi -t $(LIBPYTHONPATH)/compileall.py \
284 + -d $(LIBDESTPARAM)/site-packages -f \
285 + -x badsyntax $(LIBPYTHONPATH)/site-packages
286 + -PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
287 + ./$(BUILDPYTHON) -Wi -t -O $(LIBPYTHONPATH)/compileall.py \
288 + -d $(LIBDESTPARAM)/site-packages -f \
289 + -x badsyntax $(LIBPYTHONPATH)/site-packages
290 + -PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
291 + ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
293 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
294 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
296 @@ -896,16 +948,19 @@
297 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
298 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
299 ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
302 # Create the PLATDIR source directory, if one wasn't distributed..
303 $(srcdir)/Lib/$(PLATDIR):
304 mkdir $(srcdir)/Lib/$(PLATDIR)
305 +ifneq (@MACHDEP@,winmingw32)
306 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
307 export PATH; PATH="`pwd`:$$PATH"; \
308 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
309 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
310 export EXE; EXE="$(BUILDEXE)"; \
311 cd $(srcdir)/Lib/$(PLATDIR); ./regen
314 # Install the include files
315 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
316 @@ -992,12 +1047,21 @@
318 # Install the dynamically loadable modules
319 # This goes into $(exec_prefix)
320 +ifeq (@MACHDEP@,winmingw32)
321 +sharedinstall: $(DESTSHAREDFORRULES)
322 + $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
323 + --prefix=$(PREFIXPARAM) \
324 + --install-scripts=$(BINDIRPARAM) \
325 + --install-platlib=$(DESTSHAREDPARAM) \
326 + --root=$(DESTDIRPARAM)
329 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
331 --install-scripts=$(BINDIR) \
332 --install-platlib=$(DESTSHARED) \
336 # Here are a couple of targets for MacOSX again, to install a full
337 # framework-based Python. frameworkinstall installs everything, the
338 --- misc/Python-2.6.1/Modules/Setup.config.in 2002-12-13 02:37:50.000000000 +0900
339 +++ misc/build/Python-2.6.1/Modules/Setup.config.in 2009-03-21 18:46:57.988875000 +0900
342 @USE_SIGNAL_MODULE@signal signalmodule.c
344 +# The password module
345 +@USE_PASSWORD_MODULE@pwd pwdmodule.c # this is needed to find out the user's home dir
346 + # if $HOME is not set
348 # The rest of the modules previously listed in this file are built
349 # by the setup.py script in Python 2.1 and later.
350 --- misc/Python-2.6.1/Modules/Setup.dist 2008-11-27 19:15:12.000000000 +0900
351 +++ misc/build/Python-2.6.1/Modules/Setup.dist 2009-03-21 18:46:53.785750000 +0900
354 posix posixmodule.c # posix (UNIX) system calls
355 errno errnomodule.c # posix (UNIX) errno values
356 -pwd pwdmodule.c # this is needed to find out the user's home dir
357 +#pwd pwdmodule.c # this is needed to find out the user's home dir
358 # if $HOME is not set
359 _sre _sre.c # Fredrik Lundh's new regular expressions
360 _codecs _codecsmodule.c # access to the builtin codecs and codec registry
361 --- misc/Python-2.6.1/Modules/_ctypes/libffi/configure 2008-05-24 00:06:50.000000000 +0900
362 +++ misc/build/Python-2.6.1/Modules/_ctypes/libffi/configure 2009-04-05 08:30:43.964750000 +0900
363 @@ -22707,19 +22707,41 @@
369 + srcdir=`cd $srcdir && cmd /c cd | sed -e 's:\\\\:/:g'`
373 ac_config_commands="$ac_config_commands include"
375 ac_config_commands="$ac_config_commands src"
380 +ac_config_commands="$ac_config_commands mingw_ffitarget.h"
384 ac_config_links="$ac_config_links include/ffitarget.h:src/$TARGETDIR/ffitarget.h"
389 ac_config_files="$ac_config_files include/ffi.h"
394 +ac_config_commands="$ac_config_commands mingw_ffi_common.h"
398 ac_config_links="$ac_config_links include/ffi_common.h:include/ffi_common.h"
403 ac_config_files="$ac_config_files fficonfig.py"
405 @@ -23506,8 +23528,10 @@
406 "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
407 "include") CONFIG_COMMANDS="$CONFIG_COMMANDS include" ;;
408 "src") CONFIG_COMMANDS="$CONFIG_COMMANDS src" ;;
409 + "mingw_ffitarget.h") CONFIG_COMMANDS="$CONFIG_COMMANDS mingw_ffitarget.h" ;;
410 "include/ffitarget.h") CONFIG_LINKS="$CONFIG_LINKS include/ffitarget.h:src/$TARGETDIR/ffitarget.h" ;;
411 "include/ffi.h") CONFIG_FILES="$CONFIG_FILES include/ffi.h" ;;
412 + "mingw_ffi_common.h") CONFIG_COMMANDS="$CONFIG_COMMANDS mingw_ffi_common.h" ;;
413 "include/ffi_common.h") CONFIG_LINKS="$CONFIG_LINKS include/ffi_common.h:include/ffi_common.h" ;;
414 "fficonfig.py") CONFIG_FILES="$CONFIG_FILES fficonfig.py" ;;
416 @@ -24386,6 +24410,16 @@
417 test -d src || mkdir src
418 test -d src/$TARGETDIR || mkdir src/$TARGETDIR
420 + "mingw_ffitarget.h":C)
421 +{ echo "$as_me:$LINENO: copying $srcdir/src/$TARGETDIR/ffitarget.h to include/ffitarget.h" >&5
422 +echo "$as_me: copying $srcdir/src/$TARGETDIR/ffitarget.h to include/ffitarget.h" >&6;}
423 +cp -p $srcdir/src/$TARGETDIR/ffitarget.h include/ffitarget.h
425 + "mingw_ffi_common.h":C)
426 +{ echo "$as_me:$LINENO: copying $srcdir/include/ffi_common.h to include/ffi_common.h" >&5
427 +echo "$as_me: copying $srcdir/include/ffi_common.h to include/ffi_common.h" >&6;}
428 +cp -p $srcdir/include/ffi_common.h include/ffi_common.h
433 --- misc/Python-2.6.1/Modules/_ctypes/libffi/configure.ac 2008-05-24 00:06:50.000000000 +0900
434 +++ misc/build/Python-2.6.1/Modules/_ctypes/libffi/configure.ac 2009-04-05 08:30:27.527250000 +0900
435 @@ -358,17 +358,43 @@
441 + srcdir=`cd $srcdir && cmd /c cd | sed -e 's:\\\\:/:g'`
445 AC_CONFIG_COMMANDS(include, [test -d include || mkdir include])
446 AC_CONFIG_COMMANDS(src, [
447 test -d src || mkdir src
448 test -d src/$TARGETDIR || mkdir src/$TARGETDIR
449 ], [TARGETDIR="$TARGETDIR"])
453 +AC_CONFIG_COMMANDS(mingw_ffitarget.h, [
454 +AC_MSG_NOTICE(copying $srcdir/src/$TARGETDIR/ffitarget.h to include/ffitarget.h)
455 +cp -p $srcdir/src/$TARGETDIR/ffitarget.h include/ffitarget.h
459 AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
463 AC_CONFIG_FILES(include/ffi.h)
467 +AC_CONFIG_COMMANDS(mingw_ffi_common.h, [
468 +AC_MSG_NOTICE(copying $srcdir/include/ffi_common.h to include/ffi_common.h)
469 +cp -p $srcdir/include/ffi_common.h include/ffi_common.h
473 AC_CONFIG_LINKS(include/ffi_common.h:include/ffi_common.h)
477 AC_CONFIG_FILES(fficonfig.py)
479 --- misc/Python-2.6.1/Modules/_ctypes/libffi/include/ffi.h.in 2008-04-05 01:01:54.000000000 +0900
480 +++ misc/build/Python-2.6.1/Modules/_ctypes/libffi/include/ffi.h.in 2009-03-24 20:53:04.519875000 +0900
486 +int ffi_call(ffi_cif *cif,
488 void ffi_call(ffi_cif *cif,
493 --- misc/Python-2.6.1/Modules/config.c.in 2008-09-19 08:20:28.000000000 +0900
494 +++ misc/build/Python-2.6.1/Modules/config.c.in 2009-03-22 16:28:09.418875000 +0900
496 {"__builtin__", NULL},
498 {"exceptions", NULL},
500 + {"winmingw32", NULL},
503 /* This lives in gcmodule.c */
505 --- misc/Python-2.6.1/Modules/posixmodule.c 2008-10-10 03:06:58.000000000 +0900
506 +++ misc/build/Python-2.6.1/Modules/posixmodule.c 2009-03-22 20:04:01.404375000 +0900
509 #define fsync _commit
512 +#define HAVE_SPAWNV 1
513 +#define HAVE_EXECV 1
514 +#define HAVE_GETCWD 1
515 +#define HAVE_OPENDIR 1
517 +#define HAVE_POPEN 1
518 +#define HAVE_SYSTEM 1
520 #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS)
521 /* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */
522 #else /* all other compilers */
525 #define HAVE_TTYNAME 1
526 #endif /* PYOS_OS2 && PYCC_GCC && __VMS */
527 +#endif /* __MINGW32__ */
528 #endif /* _MSC_VER */
529 #endif /* __BORLANDC__ */
530 #endif /* ! __WATCOMC__ || __QNX__ */
532 #define pclose _pclose
533 #endif /* _MSC_VER */
537 +#include <windows.h>
538 +#include <shellapi.h> /* for ShellExecute() */
539 +#define popen _popen
540 +#define pclose _pclose
543 #if defined(PYCC_VACPP) && defined(PYOS_OS2)
548 #include <crt_externs.h>
549 static char **environ;
550 -#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
551 +#elif !defined(_MSC_VER) && !defined(__MINGW32__) && ( !defined(__WATCOMC__) || defined(__QNX__) )
552 extern char **environ;
553 #endif /* !_MSC_VER */
559 -static __int64 secs_between_epochs = 11644473600; /* Seconds between 1.1.1601 and 1.1.1970 */
560 +static __int64 secs_between_epochs = 11644473600LL; /* Seconds between 1.1.1601 and 1.1.1970 */
563 FILE_TIME_to_time_t_nsec(FILETIME *in_ptr, int *time_out, int* nsec_out)
564 @@ -8189,7 +8207,7 @@
569 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
571 PyDoc_STRVAR(win32_urandom__doc__,
572 "urandom(n) -> str\n\n\
573 @@ -8605,7 +8623,7 @@
574 #ifdef HAVE_GETLOADAVG
575 {"getloadavg", posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__},
578 + #if defined(MS_WINDOWS) && !defined(__MINGW32__)
579 {"urandom", win32_urandom, METH_VARARGS, win32_urandom__doc__},
582 --- misc/Python-2.6.1/Modules/socketmodule.c 2008-08-12 23:49:50.000000000 +0900
583 +++ misc/build/Python-2.6.1/Modules/socketmodule.c 2009-03-29 20:55:19.750375000 +0900
585 /* Do not include addrinfo.h for MSVC7 or greater. 'addrinfo' and
586 * EAI_* constants are defined in (the already included) ws2tcpip.h.
589 +#elif !defined(__MINGW32__)
590 # include "addrinfo.h"
593 --- misc/Python-2.6.1/PC/_winreg.c 2008-06-09 13:58:54.000000000 +0900
594 +++ misc/build/Python-2.6.1/PC/_winreg.c 2009-04-12 18:25:01.944250000 +0900
595 @@ -1630,6 +1630,9 @@
598 #define ADD_KEY(val) inskey(d, #val, val)
599 +#ifndef REG_LEGAL_CHANGE_FILTER
600 +#define REG_LEGAL_CHANGE_FILTER (REG_NOTIFY_CHANGE_NAME|REG_NOTIFY_CHANGE_ATTRIBUTES|REG_NOTIFY_CHANGE_LAST_SET|REG_NOTIFY_CHANGE_SECURITY)
603 PyMODINIT_FUNC init_winreg(void)
605 --- misc/Python-2.6.1/Python/dynload_win.c 2008-01-24 02:15:06.000000000 +0900
606 +++ misc/build/Python-2.6.1/Python/dynload_win.c 2009-03-21 22:05:59.683125000 +0900
608 /* Case insensitive string compare, to avoid any dependencies on particular
609 C RTL implementations */
612 static int strcasecmp (char *string1, char *string2)
617 return (first - second);
622 /* Function to return the name of the "python" DLL that the supplied module
623 --- misc/Python-2.6.1/Python/frozenmain.c 2002-07-01 00:26:10.000000000 +0900
624 +++ misc/build/Python-2.6.1/Python/frozenmain.c 2009-03-22 15:36:03.993875000 +0900
630 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
631 extern void PyWinFreeze_ExeInit(void);
632 extern void PyWinFreeze_ExeTerm(void);
633 extern int PyInitFrozenExtensions(void);
635 setbuf(stderr, (char *)NULL);
639 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
640 PyInitFrozenExtensions();
641 #endif /* MS_WINDOWS */
642 Py_SetProgramName(argv[0]);
645 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
646 PyWinFreeze_ExeInit();
650 if (inspect && isatty((int)fileno(stdin)))
651 sts = PyRun_AnyFile(stdin, "<stdin>") != 0;
654 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
655 PyWinFreeze_ExeTerm();
658 --- misc/Python-2.6.1/configure 2008-11-17 02:57:10.000000000 +0900
659 +++ misc/build/Python-2.6.1/configure 2009-04-11 16:57:56.149375000 +0900
671 @@ -2201,6 +2203,13 @@
672 LDFLAGS="$SGI_ABI $LDFLAGS"
673 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
676 + *mingw*|*MINGW*|*MinGW*)
677 + MACHDEP="winmingw32"
678 + ac_sys_system=`uname -s`
679 + ac_sys_release=`uname -r`
682 { echo "$as_me:$LINENO: result: $MACHDEP" >&5
683 echo "${ECHO_T}$MACHDEP" >&6; }
685 @@ -3995,7 +4004,7 @@
686 if test -z "$enable_shared"
688 case $ac_sys_system in
690 + CYGWIN* | MINGW* | atheos*)
691 enable_shared="yes";;
694 @@ -4096,7 +4105,7 @@
696 LDLIBRARY='libpython$(VERSION).so'
700 LDLIBRARY='libpython$(VERSION).dll.a'
701 DLLLIBRARY='libpython$(VERSION).dll'
703 @@ -4142,7 +4151,7 @@
705 else # shared is disabled
706 case $ac_sys_system in
709 BLDLIBRARY='$(LIBRARY)'
710 LDLIBRARY='libpython$(VERSION).dll.a'
712 @@ -12645,6 +12654,10 @@
716 +ac_cv_sizeof_off_t=`echo $ac_cv_sizeof_off_t | tr -d '\015'`
717 +ac_cv_sizeof_long=`echo $ac_cv_sizeof_long | tr -d '\015'`
718 +ac_cv_sizeof_long_long=`echo $ac_cv_sizeof_long_long | tr -d '\015'`
719 +ac_cv_sizeof_short=`echo $ac_cv_sizeof_short | tr -d '\015'`
720 { echo "$as_me:$LINENO: checking whether to enable large file support" >&5
721 echo $ECHO_N "checking whether to enable large file support... $ECHO_C" >&6; }
722 if test "$have_long_long" = yes -a \
723 @@ -12985,7 +12998,7 @@
728 + CYGWIN* | MINGW*) SO=.dll;;
732 @@ -13113,7 +13126,7 @@
734 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
735 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
736 - CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
737 + CYGWIN* | MINGW*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base ${LDFLAGS}";;
738 atheos*) LDSHARED="gcc -shared";;
741 @@ -13205,7 +13218,7 @@
742 LINKFORSHARED="-Xlinker --export-dynamic"
747 if test $enable_shared = "no"
749 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
750 @@ -13229,7 +13242,7 @@
751 if test ! "$LIBRARY" = "$LDLIBRARY"
753 case $ac_sys_system in
756 # Cygwin needs CCSHARED when building extension DLLs
757 # but not when building the interpreter DLL.
759 @@ -15443,7 +15456,7 @@
760 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
762 case $ac_sys_system in
766 cat >>confdefs.h <<\_ACEOF
767 #define HAVE_BROKEN_PTHREAD_SIGMASK 1
768 @@ -15457,6 +15470,17 @@
774 + THREADOBJ="Python/thread.o"
775 + USE_THREAD_MODULE="#"
776 + USE_PASSWORD_MODULE="#"
779 + USE_PASSWORD_MODULE=""
783 # Check for enable-ipv6
786 @@ -16057,6 +16081,11 @@
787 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
788 Darwin/[0156]\..*) DYNLOADFILE="dynload_next.o";;
789 atheos*) DYNLOADFILE="dynload_atheos.o";;
792 + winmingw*) DYNLOADFILE="dynload_win.o PC/import_nt.o PC/dl_nt.o";;
796 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
797 # out any dynamic loading
798 @@ -16078,6 +16107,21 @@
803 +{ echo "$as_me:$LINENO: checking GETPATH_OBJS" >&5
804 +echo $ECHO_N "checking GETPATH_OBJS... $ECHO_C" >&6; }
805 +if test -z "$GETPATH_OBJS"
809 + GETPATH_OBJS='PC/getpathp.o';;
811 + GETPATH_OBJS='Modules/getpath.o';;
814 +{ echo "$as_me:$LINENO: result: $GETPATH_OBJS" >&5
815 +echo "${ECHO_T}$GETPATH_OBJS" >&6; }
817 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
820 @@ -19952,6 +19996,112 @@
826 +{ echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5
827 +echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6; }
828 +if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then
829 + echo $ECHO_N "(cached) $ECHO_C" >&6
831 + cat >conftest.$ac_ext <<_ACEOF
834 +cat confdefs.h >>conftest.$ac_ext
835 +cat >>conftest.$ac_ext <<_ACEOF
836 +/* end confdefs.h. */
837 +$ac_includes_default
841 +static struct stat ac_aggr;
842 +if (ac_aggr.st_blocks)
848 +rm -f conftest.$ac_objext
849 +if { (ac_try="$ac_compile"
851 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
852 + *) ac_try_echo=$ac_try;;
854 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
855 + (eval "$ac_compile") 2>conftest.er1
857 + grep -v '^ *+' conftest.er1 >conftest.err
859 + cat conftest.err >&5
860 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
861 + (exit $ac_status); } && {
862 + test -z "$ac_c_werror_flag" ||
863 + test ! -s conftest.err
864 + } && test -s conftest.$ac_objext; then
865 + ac_cv_member_struct_stat_st_blocks=yes
867 + echo "$as_me: failed program was:" >&5
868 +sed 's/^/| /' conftest.$ac_ext >&5
870 + cat >conftest.$ac_ext <<_ACEOF
873 +cat confdefs.h >>conftest.$ac_ext
874 +cat >>conftest.$ac_ext <<_ACEOF
875 +/* end confdefs.h. */
876 +$ac_includes_default
880 +static struct stat ac_aggr;
881 +if (sizeof ac_aggr.st_blocks)
887 +rm -f conftest.$ac_objext
888 +if { (ac_try="$ac_compile"
890 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
891 + *) ac_try_echo=$ac_try;;
893 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
894 + (eval "$ac_compile") 2>conftest.er1
896 + grep -v '^ *+' conftest.er1 >conftest.err
898 + cat conftest.err >&5
899 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
900 + (exit $ac_status); } && {
901 + test -z "$ac_c_werror_flag" ||
902 + test ! -s conftest.err
903 + } && test -s conftest.$ac_objext; then
904 + ac_cv_member_struct_stat_st_blocks=yes
906 + echo "$as_me: failed program was:" >&5
907 +sed 's/^/| /' conftest.$ac_ext >&5
909 + ac_cv_member_struct_stat_st_blocks=no
912 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
915 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
917 +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blocks" >&5
918 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_blocks" >&6; }
919 +if test $ac_cv_member_struct_stat_st_blocks = yes; then
921 +cat >>confdefs.h <<_ACEOF
922 +#define HAVE_STRUCT_STAT_ST_BLOCKS 1
930 { echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5
931 echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6; }
932 if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then
933 @@ -20066,6 +20216,8 @@
940 { echo "$as_me:$LINENO: checking for time.h that defines altzone" >&5
941 echo $ECHO_N "checking for time.h that defines altzone... $ECHO_C" >&6; }
942 @@ -22530,6 +22682,7 @@
946 +ac_cv_sizeof_wchar_t=`echo $ac_cv_sizeof_wchar_t | tr -d '\015'`
948 if test "$enable_unicode" = "no"
950 @@ -25368,8 +25521,10 @@
951 USE_THREAD_MODULE!$USE_THREAD_MODULE$ac_delim
952 LDLAST!$LDLAST$ac_delim
953 THREADOBJ!$THREADOBJ$ac_delim
954 +USE_PASSWORD_MODULE!$USE_PASSWORD_MODULE$ac_delim
955 DLINCLDIR!$DLINCLDIR$ac_delim
956 DYNLOADFILE!$DYNLOADFILE$ac_delim
957 +GETPATH_OBJS!$GETPATH_OBJS$ac_delim
958 MACHDEP_OBJS!$MACHDEP_OBJS$ac_delim
960 LIBOBJS!$LIBOBJS$ac_delim
961 @@ -25386,7 +25541,7 @@
962 LTLIBOBJS!$LTLIBOBJS$ac_delim
965 - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 22; then
966 + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 24; then
968 elif $ac_last_try; then
969 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
970 --- misc/Python-2.6.1/configure.in 2008-11-16 17:02:56.000000000 +0900
971 +++ misc/build/Python-2.6.1/configure.in 2009-04-11 16:56:07.258750000 +0900
973 LDFLAGS="$SGI_ABI $LDFLAGS"
974 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
977 + *mingw*|*MINGW*|*MinGW*)
978 + MACHDEP="winmingw32"
979 + ac_sys_system=`uname -s`
980 + ac_sys_release=`uname -r`
983 AC_MSG_RESULT($MACHDEP)
985 # And add extra plat-mac for darwin
987 if test -z "$enable_shared"
989 case $ac_sys_system in
991 + CYGWIN* | MINGW* | atheos*)
992 enable_shared="yes";;
997 LDLIBRARY='libpython$(VERSION).so'
1001 LDLIBRARY='libpython$(VERSION).dll.a'
1002 DLLLIBRARY='libpython$(VERSION).dll'
1006 else # shared is disabled
1007 case $ac_sys_system in
1010 BLDLIBRARY='$(LIBRARY)'
1011 LDLIBRARY='libpython$(VERSION).dll.a'
1013 @@ -1402,6 +1409,10 @@
1014 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
1015 [The number of bytes in an off_t.])
1017 +ac_cv_sizeof_off_t=`echo $ac_cv_sizeof_off_t | tr -d '\015'`
1018 +ac_cv_sizeof_long=`echo $ac_cv_sizeof_long | tr -d '\015'`
1019 +ac_cv_sizeof_long_long=`echo $ac_cv_sizeof_long_long | tr -d '\015'`
1020 +ac_cv_sizeof_short=`echo $ac_cv_sizeof_short | tr -d '\015'`
1021 AC_MSG_CHECKING(whether to enable large file support)
1022 if test "$have_long_long" = yes -a \
1023 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1024 @@ -1581,7 +1592,7 @@
1028 - CYGWIN*) SO=.dll;;
1029 + CYGWIN* | MINGW*) SO=.dll;;
1033 @@ -1703,7 +1714,7 @@
1035 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
1036 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
1037 - CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
1038 + CYGWIN* | MINGW*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base ${LDFLAGS}";;
1039 atheos*) LDSHARED="gcc -shared";;
1042 @@ -1791,7 +1802,7 @@
1043 LINKFORSHARED="-Xlinker --export-dynamic"
1048 if test $enable_shared = "no"
1050 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1051 @@ -1813,7 +1824,7 @@
1052 if test ! "$LIBRARY" = "$LDLIBRARY"
1054 case $ac_sys_system in
1057 # Cygwin needs CCSHARED when building extension DLLs
1058 # but not when building the interpreter DLL.
1059 CFLAGSFORSHARED='';;
1060 @@ -2149,13 +2160,24 @@
1062 AC_CHECK_FUNCS(pthread_sigmask,
1063 [case $ac_sys_system in
1066 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
1067 [Define if pthread_sigmask() does not work on your system.])
1072 +AC_SUBST(USE_PASSWORD_MODULE)
1075 + THREADOBJ="Python/thread.o"
1076 + USE_THREAD_MODULE="#"
1077 + USE_PASSWORD_MODULE="#"
1080 + USE_PASSWORD_MODULE=""
1084 # Check for enable-ipv6
1085 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
1086 @@ -2415,6 +2437,11 @@
1087 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
1088 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
1089 atheos*) DYNLOADFILE="dynload_atheos.o";;
1092 + winmingw*) DYNLOADFILE="dynload_win.o PC/import_nt.o PC/dl_nt.o";;
1096 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1097 # out any dynamic loading
1098 @@ -2432,6 +2459,19 @@
1099 [Defined when any dynamic module loading is enabled.])
1102 +AC_SUBST(GETPATH_OBJS)
1103 +AC_MSG_CHECKING(GETPATH_OBJS)
1104 +if test -z "$GETPATH_OBJS"
1108 + GETPATH_OBJS='PC/getpathp.o';;
1110 + GETPATH_OBJS='Modules/getpath.o';;
1113 +AC_MSG_RESULT($GETPATH_OBJS)
1115 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
1117 AC_SUBST(MACHDEP_OBJS)
1118 @@ -2862,7 +2902,14 @@
1119 AC_CHECK_MEMBERS([struct stat.st_flags])
1120 AC_CHECK_MEMBERS([struct stat.st_gen])
1121 AC_CHECK_MEMBERS([struct stat.st_birthtime])
1124 +AC_CHECK_MEMBERS([struct stat.st_blocks])
1131 AC_MSG_CHECKING(for time.h that defines altzone)
1132 AC_CACHE_VAL(ac_cv_header_time_altzone,
1133 @@ -3247,6 +3294,7 @@
1134 AH_TEMPLATE(PY_UNICODE_TYPE,
1135 [Define as the integral type used for Unicode representation.])
1137 +ac_cv_sizeof_wchar_t=`echo $ac_cv_sizeof_wchar_t | tr -d '\015'`
1138 AC_SUBST(UNICODE_OBJS)
1139 if test "$enable_unicode" = "no"
1141 --- misc/Python-2.6.1/setup.py 2008-11-05 05:43:31.000000000 +0900
1142 +++ misc/build/Python-2.6.1/setup.py 2009-04-12 16:02:22.654125000 +0900
1143 @@ -234,6 +234,18 @@
1144 if not self.configure_ctypes(ext):
1147 + if self.get_platform() == "winmingw":
1148 + if ext.name == '_ctypes_test':
1149 + ext.libraries.append('oleaut32')
1150 + elif ext.name == 'select':
1151 + ext.libraries.append('ws2_32')
1152 + elif ext.name == '_socket':
1153 + ext.libraries.append('ws2_32')
1154 + if ext.name == '_ctypes':
1155 + ext.libraries.append('uuid')
1156 + ext.libraries.append('oleaut32')
1157 + ext.libraries.append('ole32')
1160 build_ext.build_extension(self, ext)
1161 except (CCompilerError, DistutilsError), why:
1164 # Workaround for Cygwin: Cygwin currently has fork issues when many
1165 # modules have been imported
1166 - if self.get_platform() == 'cygwin':
1167 + if self.get_platform() in ['cygwin', 'winmingw']:
1168 self.announce('WARNING: skipping import check for Cygwin-based "%s"'
1173 def get_platform(self):
1174 # Get value of sys.platform
1175 - for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
1176 + for platform in ['cygwin', 'winmingw', 'beos', 'darwin', 'atheos', 'osf1']:
1177 if sys.platform.startswith(platform):
1180 @@ -1009,7 +1021,7 @@
1181 missing.append('bsddb185')
1183 # The standard Unix dbm module:
1184 - if platform not in ['cygwin']:
1185 + if platform not in ['cygwin', 'winmingw']:
1186 if find_file("ndbm.h", inc_dirs, []) is not None:
1187 # Some systems have -lndbm, others don't
1188 if self.compiler.find_library_file(lib_dirs, 'ndbm'):
1189 @@ -1053,7 +1065,7 @@
1190 missing.append('resource')
1192 # Sun yellow pages. Some systems have the functions in libc.
1193 - if platform not in ['cygwin', 'atheos', 'qnx6']:
1194 + if platform not in ['cygwin', 'winmingw', 'atheos', 'qnx6']:
1195 if (self.compiler.find_library_file(lib_dirs, 'nsl')):
1198 @@ -1252,14 +1264,14 @@
1202 - elif platform == 'cygwin': # Cygwin
1203 + elif platform in ['cygwin', 'winmingw']: # Cygwin
1206 HAVE_SEM_TIMEDWAIT=1,
1208 HAVE_BROKEN_SEM_UNLINK=1
1211 + libraries = ['ws2_32']
1213 elif platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
1214 # FreeBSD's P1003.1b semaphore support is very experimental
1215 @@ -1287,7 +1299,7 @@
1219 - if platform == 'win32':
1220 + if platform in ['win32', 'winmingw']:
1221 multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c',
1222 '_multiprocessing/semaphore.c',
1223 '_multiprocessing/pipe_connection.c',
1224 @@ -1305,6 +1317,7 @@
1226 exts.append ( Extension('_multiprocessing', multiprocessing_srcs,
1227 define_macros=macros.items(),
1228 + libraries=libraries,
1229 include_dirs=["Modules/_multiprocessing"]))
1230 # End multiprocessing
1232 @@ -1423,6 +1436,10 @@
1233 '-framework', 'Carbon']) )
1236 + if platform == 'winmingw':
1237 + exts.append( Extension('_winreg', ['../PC/_winreg.c']) )
1238 + exts.append( Extension('winsound', ['../PC/winsound.c'], libraries = ['winmm']) )
1240 self.extensions.extend(exts)
1242 # Call the method for detecting whether _tkinter can be compiled
1243 @@ -1575,7 +1592,7 @@
1244 added_lib_dirs.append('/usr/X11/lib')
1246 # If Cygwin, then verify that X is installed before proceeding
1247 - if platform == 'cygwin':
1248 + if platform in ['cygwin', 'winmingw']:
1249 x11_inc = find_file('X11/Xlib.h', [], include_dirs)
1252 @@ -1598,7 +1615,7 @@
1255 # Finally, link with the X11 libraries (not appropriate on cygwin)
1256 - if platform != "cygwin":
1257 + if not platform in ["cygwin", "winmingw"]:
1260 ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
1261 @@ -1669,6 +1686,8 @@
1262 from distutils.dir_util import mkpath
1263 mkpath(ffi_builddir)
1265 + if self.get_platform() == "winmingw":
1266 + config_args.append(" --build=mingw32")
1268 # Pass empty CFLAGS because we'll just append the resulting
1269 # CFLAGS to Python's; -g or -O2 is to be avoided.