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
14 +#define Py_WIN_WIDE_FILENAMES
16 +# define PYTHONPATH ".\\lib;.\\lib\\python" VERSION ";.\\lib\\python" VERSION "\\lib-dynload;.\\lib\\python" VERSION "\\plat-winmingw32;.\\lib\\python" VERSION "\\lib-tk"
20 +#define WINVER 0x0501
21 +#define HAVE_ADDRINFO
22 +#define HAVE_GETADDRINFO
23 +#define HAVE_GETNAMEINFO
24 +#define HAVE_GETPEERNAME
30 --- misc/Python-2.6.1/Lib/distutils/ccompiler.py 2008-02-22 03:18:37.000000000 +0900
31 +++ misc/build/Python-2.6.1/Lib/distutils/ccompiler.py 2009-04-04 01:00:37.014250000 +0900
33 # on a cygwin built python we can use gcc like an ordinary UNIXish
36 + ('winmingw*', 'unix'),
40 --- misc/Python-2.6.1/Lib/distutils/command/build_ext.py 2008-08-17 13:16:04.000000000 +0900
41 +++ misc/build/Python-2.6.1/Lib/distutils/command/build_ext.py 2009-04-04 01:05:32.311125000 +0900
44 # for extensions under Cygwin and AtheOS Python's library directory must be
45 # appended to library_dirs
46 - if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos':
47 + if sys.platform[:6] == 'cygwin' or sys.platform[:8] == 'winmingw' or sys.platform[:6] == 'atheos':
48 if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
49 # building third party extensions
50 self.library_dirs.append(os.path.join(sys.prefix, "lib",
52 # don't extend ext.libraries, it may be shared with other
53 # extensions, it is a reference to the original list
54 return ext.libraries + [pythonlib]
55 - elif sys.platform[:6] == "cygwin":
56 + elif sys.platform[:6] == "cygwin" or sys.platform[:8] == "winmingw":
57 template = "python%d.%d"
58 pythonlib = (template %
59 (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff))
60 --- misc/Python-2.6.1/Lib/distutils/command/install.py 2008-05-07 07:41:46.000000000 +0900
61 +++ misc/build/Python-2.6.1/Lib/distutils/command/install.py 2009-04-05 23:15:56.540750000 +0900
64 # Convert directories from Unix /-separated syntax to the local
66 - self.convert_paths('lib', 'purelib', 'platlib',
67 - 'scripts', 'data', 'headers',
68 - 'userbase', 'usersite')
70 + self.convert_paths('lib', 'purelib', 'platlib',
71 + 'scripts', 'data', 'headers',
72 + 'userbase', 'usersite')
74 # Well, we're not actually fully completely finalized yet: we still
75 # have to deal with 'extra_path', which is the hack for allowing
78 # If a new root directory was supplied, make all the installation
79 # dirs relative to it.
80 - if self.root is not None:
81 + if self.root is not None and self.root != "":
82 self.change_roots('libbase', 'lib', 'purelib', 'platlib',
83 'scripts', 'data', 'headers')
86 def convert_paths (self, *names):
88 attr = "install_" + name
89 - setattr(self, attr, convert_path(getattr(self, attr)))
90 + if self.root is None or self.root == "":
91 + setattr(self, attr, getattr(self, attr).replace('/', os.sep))
93 + setattr(self, attr, convert_path(getattr(self, attr)))
96 def handle_extra_path (self):
97 --- misc/Python-2.6.1/Lib/distutils/spawn.py 2004-11-11 07:23:15.000000000 +0900
98 +++ misc/build/Python-2.6.1/Lib/distutils/spawn.py 2009-03-22 19:38:32.935625000 +0900
100 path = os.environ['PATH']
101 paths = string.split(path, os.pathsep)
102 (base, ext) = os.path.splitext(executable)
103 - if (sys.platform == 'win32' or os.name == 'os2') and (ext != '.exe'):
104 + if (sys.platform == 'win32' or sys.platform[:8] == "winmingw" or os.name == 'os2') and (ext != '.exe'):
105 executable = executable + '.exe'
106 if not os.path.isfile(executable):
108 --- misc/Python-2.6.1/Lib/distutils/sysconfig.py 2008-06-05 21:58:24.000000000 +0900
109 +++ misc/build/Python-2.6.1/Lib/distutils/sysconfig.py 2009-03-29 10:56:10.965750000 +0900
112 raise DistutilsPlatformError(my_msg)
114 + if sys.platform[:8] == "winmingw":
117 # On MacOSX we need to check the setting of the environment variable
118 # MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so
119 # it needs to be compatible.
122 if _config_vars is None:
123 func = globals().get("_init_" + os.name)
124 + if sys.platform[:8] == "winmingw":
125 + func = globals().get("_init_posix")
130 --- misc/Python-2.6.1/Lib/distutils/unixccompiler.py 2008-07-16 22:24:06.000000000 +0900
131 +++ misc/build/Python-2.6.1/Lib/distutils/unixccompiler.py 2009-04-04 01:11:18.420500000 +0900
133 shared_lib_extension = ".so"
134 dylib_lib_extension = ".dylib"
135 static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s"
136 - if sys.platform == "cygwin":
137 + if sys.platform == "cygwin" or sys.platform == "winmingw":
138 exe_extension = ".exe"
140 def preprocess(self, source,
141 --- misc/Python-2.6.1/Lib/os.py 2008-09-02 14:36:11.000000000 +0900
142 +++ misc/build/Python-2.6.1/Lib/os.py 2009-03-22 16:55:18.356375000 +0900
144 except AttributeError:
145 return [n for n in dir(module) if n[0] != '_']
147 -if 'posix' in _names:
148 +if 'winmingw32' in _names:
151 + from posix import *
153 + from posix import _exit
154 + except ImportError:
156 + import ntpath as path
159 + __all__.extend(_get_exports_list(posix))
162 +elif 'posix' in _names:
166 --- misc/Python-2.6.1/Lib/socket.py 2008-08-08 13:27:28.000000000 +0900
167 +++ misc/build/Python-2.6.1/Lib/socket.py 2009-04-02 00:40:46.941750000 +0900
169 'sendall', 'setblocking',
170 'settimeout', 'gettimeout', 'shutdown')
173 +if os.name == "nt" and sys.platform[:8] != "winmingw":
174 _socketmethods = _socketmethods + ('ioctl',)
176 if sys.platform == "riscos":
177 --- misc/Python-2.6.1/Makefile.pre.in 2008-10-22 01:48:37.000000000 +0900
178 +++ misc/build/Python-2.6.1/Makefile.pre.in 2009-04-08 23:38:27.989250000 +0900
181 BLDSHARED= @BLDSHARED@
182 DESTSHARED= $(BINLIBDEST)/lib-dynload
183 +ifeq (@MACHDEP@,winmingw32)
184 +DESTSHAREDFORRULES= $(shell cd $(DESTSHARED) && pwd || echo DESTSHARED)
185 +LIBPYTHONPATH= $(shell cd $(DESTDIR)$(LIBDEST) && cmd /c cd | sed -e s:\\\\:/:g)
186 +DESTPYTHONPATH= $(LIBPYTHONPATH);$(shell cd $(DESTDIR)$(DESTSHARED) && cmd /c cd | sed -e s:\\\\:/:g)
187 +LIBDESTPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(LIBDEST) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(LIBDEST) ; fi)
188 +PREFIXPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(prefix) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(prefix) ; fi)
189 +BINDIRPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(BINDIR) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(BINDIR) ; fi)
190 +DESTSHAREDPARAM= $(shell if test -z "$(DESTDIR)" ; then cd $(DESTSHARED) && cmd /c cd | sed -e s:\\\\:/:g ; else echo $(DESTSHARED) ; fi)
191 +DESTDIRPARAM= $(shell if test ! -z "$(DESTDIR)" ; then cd $(DESTDIR) && cmd /c | sed -e s:\\\\:/:g ; fi)
194 # Executable suffix (.exe on Windows and Mac OS X)
200 - Modules/getpath.o \
206 -DVPATH='"$(VPATH)"' \
207 -o $@ $(srcdir)/Modules/getpath.c
209 +PC/getpathp.o: $(srcdir)/PC/getpathp.c Makefile
210 + $(CC) -c $(PY_CFLAGS) -DVERSION='"$(VERSION)"' \
211 + -o $@ $(srcdir)/PC/getpathp.c
213 Modules/python.o: $(srcdir)/Modules/python.c
214 $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
217 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
218 $(srcdir)/Objects/unicodetype_db.h
220 +Objects/exceptions.o: $(srcdir)/Objects/exceptions.c
221 + $(CC) -c $(PY_CFLAGS) -I$(srcdir)/PC -o $@ $(srcdir)/Objects/exceptions.c
223 +PC/import_nt.o: $(srcdir)/PC/import_nt.c
224 + $(CC) -c $(PY_CFLAGS) -I$(srcdir)/Python -o $@ $(srcdir)/PC/import_nt.c
227 $(srcdir)/Include/bytes_methods.h \
228 $(srcdir)/Objects/stringlib/count.h \
230 # Install shared libraries enabled by Setup
231 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
233 +ifeq (@MACHDEP@,winmingw32)
234 +oldsharedinstall: $(DESTSHAREDFORRULES) $(SHAREDMODS)
236 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
238 @for i in X $(SHAREDMODS); do \
239 if test $$i != X; then \
240 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
245 +ifeq (@MACHDEP@,winmingw32)
246 +$(DESTSHAREDFORRULES):
250 @for i in $(DESTDIRS); \
252 if test ! -d $(DESTDIR)$$i; then \
254 multiprocessing multiprocessing/dummy \
257 +ifeq (@MACHDEP@,winmingw32)
258 +libinstall: build_all $(srcdir)/Lib/$(PLATDIR) sharedinstall
260 libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
262 @for i in $(SCRIPTDIR) $(LIBDEST); \
264 if test ! -d $(DESTDIR)$$i; then \
268 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
269 +ifeq (@MACHDEP@,winmingw32)
270 + PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
271 + ./$(BUILDPYTHON) -Wi -tt $(LIBPYTHONPATH)/compileall.py \
272 + -d $(LIBDESTPARAM) -f \
273 + -x 'bad_coding|badsyntax|site-packages' $(LIBPYTHONPATH)
274 + PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
275 + ./$(BUILDPYTHON) -Wi -tt -O $(LIBPYTHONPATH)/compileall.py \
276 + -d $(LIBDESTPARAM) -f \
277 + -x 'bad_coding|badsyntax|site-packages' $(LIBPYTHONPATH)
278 + -PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
279 + ./$(BUILDPYTHON) -Wi -t $(LIBPYTHONPATH)/compileall.py \
280 + -d $(LIBDESTPARAM)/site-packages -f \
281 + -x badsyntax $(LIBPYTHONPATH)/site-packages
282 + -PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
283 + ./$(BUILDPYTHON) -Wi -t -O $(LIBPYTHONPATH)/compileall.py \
284 + -d $(LIBDESTPARAM)/site-packages -f \
285 + -x badsyntax $(LIBPYTHONPATH)/site-packages
286 + -PYTHONPATH="$(DESTPYTHONPATH)" $(RUNSHARED) \
287 + ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
289 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
290 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
292 @@ -896,16 +948,19 @@
293 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
294 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
295 ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
298 # Create the PLATDIR source directory, if one wasn't distributed..
299 $(srcdir)/Lib/$(PLATDIR):
300 mkdir $(srcdir)/Lib/$(PLATDIR)
301 +ifneq (@MACHDEP@,winmingw32)
302 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
303 export PATH; PATH="`pwd`:$$PATH"; \
304 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
305 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
306 export EXE; EXE="$(BUILDEXE)"; \
307 cd $(srcdir)/Lib/$(PLATDIR); ./regen
310 # Install the include files
311 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
312 @@ -992,12 +1047,21 @@
314 # Install the dynamically loadable modules
315 # This goes into $(exec_prefix)
316 +ifeq (@MACHDEP@,winmingw32)
317 +sharedinstall: $(DESTSHAREDFORRULES)
318 + $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
319 + --prefix=$(PREFIXPARAM) \
320 + --install-scripts=$(BINDIRPARAM) \
321 + --install-platlib=$(DESTSHAREDPARAM) \
322 + --root=$(DESTDIRPARAM)
325 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
327 --install-scripts=$(BINDIR) \
328 --install-platlib=$(DESTSHARED) \
332 # Here are a couple of targets for MacOSX again, to install a full
333 # framework-based Python. frameworkinstall installs everything, the
334 --- misc/Python-2.6.1/Modules/Setup.config.in 2002-12-13 02:37:50.000000000 +0900
335 +++ misc/build/Python-2.6.1/Modules/Setup.config.in 2009-03-21 18:46:57.988875000 +0900
338 @USE_SIGNAL_MODULE@signal signalmodule.c
340 +# The password module
341 +@USE_PASSWORD_MODULE@pwd pwdmodule.c # this is needed to find out the user's home dir
342 + # if $HOME is not set
344 # The rest of the modules previously listed in this file are built
345 # by the setup.py script in Python 2.1 and later.
346 --- misc/Python-2.6.1/Modules/Setup.dist 2008-11-27 19:15:12.000000000 +0900
347 +++ misc/build/Python-2.6.1/Modules/Setup.dist 2009-03-21 18:46:53.785750000 +0900
350 posix posixmodule.c # posix (UNIX) system calls
351 errno errnomodule.c # posix (UNIX) errno values
352 -pwd pwdmodule.c # this is needed to find out the user's home dir
353 +#pwd pwdmodule.c # this is needed to find out the user's home dir
354 # if $HOME is not set
355 _sre _sre.c # Fredrik Lundh's new regular expressions
356 _codecs _codecsmodule.c # access to the builtin codecs and codec registry
357 --- misc/Python-2.6.1/Modules/_ctypes/libffi/configure 2008-05-24 00:06:50.000000000 +0900
358 +++ misc/build/Python-2.6.1/Modules/_ctypes/libffi/configure 2009-04-05 08:30:43.964750000 +0900
359 @@ -22707,19 +22707,41 @@
365 + srcdir=`cd $srcdir && cmd /c cd | sed -e 's:\\\\:/:g'`
369 ac_config_commands="$ac_config_commands include"
371 ac_config_commands="$ac_config_commands src"
376 +ac_config_commands="$ac_config_commands mingw_ffitarget.h"
380 ac_config_links="$ac_config_links include/ffitarget.h:src/$TARGETDIR/ffitarget.h"
385 ac_config_files="$ac_config_files include/ffi.h"
390 +ac_config_commands="$ac_config_commands mingw_ffi_common.h"
394 ac_config_links="$ac_config_links include/ffi_common.h:include/ffi_common.h"
399 ac_config_files="$ac_config_files fficonfig.py"
401 @@ -23506,8 +23528,10 @@
402 "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
403 "include") CONFIG_COMMANDS="$CONFIG_COMMANDS include" ;;
404 "src") CONFIG_COMMANDS="$CONFIG_COMMANDS src" ;;
405 + "mingw_ffitarget.h") CONFIG_COMMANDS="$CONFIG_COMMANDS mingw_ffitarget.h" ;;
406 "include/ffitarget.h") CONFIG_LINKS="$CONFIG_LINKS include/ffitarget.h:src/$TARGETDIR/ffitarget.h" ;;
407 "include/ffi.h") CONFIG_FILES="$CONFIG_FILES include/ffi.h" ;;
408 + "mingw_ffi_common.h") CONFIG_COMMANDS="$CONFIG_COMMANDS mingw_ffi_common.h" ;;
409 "include/ffi_common.h") CONFIG_LINKS="$CONFIG_LINKS include/ffi_common.h:include/ffi_common.h" ;;
410 "fficonfig.py") CONFIG_FILES="$CONFIG_FILES fficonfig.py" ;;
412 @@ -24386,6 +24410,16 @@
413 test -d src || mkdir src
414 test -d src/$TARGETDIR || mkdir src/$TARGETDIR
416 + "mingw_ffitarget.h":C)
417 +{ echo "$as_me:$LINENO: copying $srcdir/src/$TARGETDIR/ffitarget.h to include/ffitarget.h" >&5
418 +echo "$as_me: copying $srcdir/src/$TARGETDIR/ffitarget.h to include/ffitarget.h" >&6;}
419 +cp -p $srcdir/src/$TARGETDIR/ffitarget.h include/ffitarget.h
421 + "mingw_ffi_common.h":C)
422 +{ echo "$as_me:$LINENO: copying $srcdir/include/ffi_common.h to include/ffi_common.h" >&5
423 +echo "$as_me: copying $srcdir/include/ffi_common.h to include/ffi_common.h" >&6;}
424 +cp -p $srcdir/include/ffi_common.h include/ffi_common.h
429 --- misc/Python-2.6.1/Modules/_ctypes/libffi/configure.ac 2008-05-24 00:06:50.000000000 +0900
430 +++ misc/build/Python-2.6.1/Modules/_ctypes/libffi/configure.ac 2009-04-05 08:30:27.527250000 +0900
431 @@ -358,17 +358,43 @@
437 + srcdir=`cd $srcdir && cmd /c cd | sed -e 's:\\\\:/:g'`
441 AC_CONFIG_COMMANDS(include, [test -d include || mkdir include])
442 AC_CONFIG_COMMANDS(src, [
443 test -d src || mkdir src
444 test -d src/$TARGETDIR || mkdir src/$TARGETDIR
445 ], [TARGETDIR="$TARGETDIR"])
449 +AC_CONFIG_COMMANDS(mingw_ffitarget.h, [
450 +AC_MSG_NOTICE(copying $srcdir/src/$TARGETDIR/ffitarget.h to include/ffitarget.h)
451 +cp -p $srcdir/src/$TARGETDIR/ffitarget.h include/ffitarget.h
455 AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
459 AC_CONFIG_FILES(include/ffi.h)
463 +AC_CONFIG_COMMANDS(mingw_ffi_common.h, [
464 +AC_MSG_NOTICE(copying $srcdir/include/ffi_common.h to include/ffi_common.h)
465 +cp -p $srcdir/include/ffi_common.h include/ffi_common.h
469 AC_CONFIG_LINKS(include/ffi_common.h:include/ffi_common.h)
473 AC_CONFIG_FILES(fficonfig.py)
475 --- misc/Python-2.6.1/Modules/_ctypes/libffi/include/ffi.h.in 2008-04-05 01:01:54.000000000 +0900
476 +++ misc/build/Python-2.6.1/Modules/_ctypes/libffi/include/ffi.h.in 2009-03-24 20:53:04.519875000 +0900
482 +int ffi_call(ffi_cif *cif,
484 void ffi_call(ffi_cif *cif,
489 --- misc/Python-2.6.1/Modules/config.c.in 2008-09-19 08:20:28.000000000 +0900
490 +++ misc/build/Python-2.6.1/Modules/config.c.in 2009-03-22 16:28:09.418875000 +0900
492 {"__builtin__", NULL},
494 {"exceptions", NULL},
496 + {"winmingw32", NULL},
499 /* This lives in gcmodule.c */
501 --- misc/Python-2.6.1/Modules/posixmodule.c 2008-10-10 03:06:58.000000000 +0900
502 +++ misc/build/Python-2.6.1/Modules/posixmodule.c 2009-03-22 20:04:01.404375000 +0900
505 #define fsync _commit
508 +#define HAVE_SPAWNV 1
509 +#define HAVE_EXECV 1
510 +#define HAVE_GETCWD 1
511 +#define HAVE_OPENDIR 1
513 +#define HAVE_POPEN 1
514 +#define HAVE_SYSTEM 1
516 #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS)
517 /* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */
518 #else /* all other compilers */
521 #define HAVE_TTYNAME 1
522 #endif /* PYOS_OS2 && PYCC_GCC && __VMS */
523 +#endif /* __MINGW32__ */
524 #endif /* _MSC_VER */
525 #endif /* __BORLANDC__ */
526 #endif /* ! __WATCOMC__ || __QNX__ */
528 #define pclose _pclose
529 #endif /* _MSC_VER */
533 +#include <windows.h>
534 +#include <shellapi.h> /* for ShellExecute() */
535 +#define popen _popen
536 +#define pclose _pclose
539 #if defined(PYCC_VACPP) && defined(PYOS_OS2)
544 #include <crt_externs.h>
545 static char **environ;
546 -#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
547 +#elif !defined(_MSC_VER) && !defined(__MINGW32__) && ( !defined(__WATCOMC__) || defined(__QNX__) )
548 extern char **environ;
549 #endif /* !_MSC_VER */
555 -static __int64 secs_between_epochs = 11644473600; /* Seconds between 1.1.1601 and 1.1.1970 */
556 +static __int64 secs_between_epochs = 11644473600LL; /* Seconds between 1.1.1601 and 1.1.1970 */
559 FILE_TIME_to_time_t_nsec(FILETIME *in_ptr, int *time_out, int* nsec_out)
560 @@ -8189,7 +8207,7 @@
565 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
567 PyDoc_STRVAR(win32_urandom__doc__,
568 "urandom(n) -> str\n\n\
569 @@ -8605,7 +8623,7 @@
570 #ifdef HAVE_GETLOADAVG
571 {"getloadavg", posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__},
574 + #if defined(MS_WINDOWS) && !defined(__MINGW32__)
575 {"urandom", win32_urandom, METH_VARARGS, win32_urandom__doc__},
578 --- misc/Python-2.6.1/Modules/socketmodule.c 2008-08-12 23:49:50.000000000 +0900
579 +++ misc/build/Python-2.6.1/Modules/socketmodule.c 2009-03-29 20:55:19.750375000 +0900
581 /* Do not include addrinfo.h for MSVC7 or greater. 'addrinfo' and
582 * EAI_* constants are defined in (the already included) ws2tcpip.h.
585 +#elif !defined(__MINGW32__)
586 # include "addrinfo.h"
589 --- misc/Python-2.6.1/PC/_winreg.c 2008-06-09 13:58:54.000000000 +0900
590 +++ misc/build/Python-2.6.1/PC/_winreg.c 2009-04-12 18:25:01.944250000 +0900
591 @@ -1630,6 +1630,9 @@
594 #define ADD_KEY(val) inskey(d, #val, val)
595 +#ifndef REG_LEGAL_CHANGE_FILTER
596 +#define REG_LEGAL_CHANGE_FILTER (REG_NOTIFY_CHANGE_NAME|REG_NOTIFY_CHANGE_ATTRIBUTES|REG_NOTIFY_CHANGE_LAST_SET|REG_NOTIFY_CHANGE_SECURITY)
599 PyMODINIT_FUNC init_winreg(void)
601 --- misc/Python-2.6.1/Python/dynload_win.c 2008-01-24 02:15:06.000000000 +0900
602 +++ misc/build/Python-2.6.1/Python/dynload_win.c 2009-03-21 22:05:59.683125000 +0900
604 /* Case insensitive string compare, to avoid any dependencies on particular
605 C RTL implementations */
608 static int strcasecmp (char *string1, char *string2)
613 return (first - second);
618 /* Function to return the name of the "python" DLL that the supplied module
619 --- misc/Python-2.6.1/Python/frozenmain.c 2002-07-01 00:26:10.000000000 +0900
620 +++ misc/build/Python-2.6.1/Python/frozenmain.c 2009-03-22 15:36:03.993875000 +0900
626 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
627 extern void PyWinFreeze_ExeInit(void);
628 extern void PyWinFreeze_ExeTerm(void);
629 extern int PyInitFrozenExtensions(void);
631 setbuf(stderr, (char *)NULL);
635 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
636 PyInitFrozenExtensions();
637 #endif /* MS_WINDOWS */
638 Py_SetProgramName(argv[0]);
641 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
642 PyWinFreeze_ExeInit();
646 if (inspect && isatty((int)fileno(stdin)))
647 sts = PyRun_AnyFile(stdin, "<stdin>") != 0;
650 +#if defined(MS_WINDOWS) && !defined(__MINGW32__)
651 PyWinFreeze_ExeTerm();
654 --- misc/Python-2.6.1/configure 2008-11-17 02:57:10.000000000 +0900
655 +++ misc/build/Python-2.6.1/configure 2009-04-11 16:57:56.149375000 +0900
667 @@ -2201,6 +2203,13 @@
668 LDFLAGS="$SGI_ABI $LDFLAGS"
669 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
672 + *mingw*|*MINGW*|*MinGW*)
673 + MACHDEP="winmingw32"
674 + ac_sys_system=`uname -s`
675 + ac_sys_release=`uname -r`
678 { echo "$as_me:$LINENO: result: $MACHDEP" >&5
679 echo "${ECHO_T}$MACHDEP" >&6; }
681 @@ -3995,7 +4004,7 @@
682 if test -z "$enable_shared"
684 case $ac_sys_system in
686 + CYGWIN* | MINGW* | atheos*)
687 enable_shared="yes";;
690 @@ -4096,7 +4105,7 @@
692 LDLIBRARY='libpython$(VERSION).so'
696 LDLIBRARY='libpython$(VERSION).dll.a'
697 DLLLIBRARY='libpython$(VERSION).dll'
699 @@ -4142,7 +4151,7 @@
701 else # shared is disabled
702 case $ac_sys_system in
705 BLDLIBRARY='$(LIBRARY)'
706 LDLIBRARY='libpython$(VERSION).dll.a'
708 @@ -12645,6 +12654,10 @@
712 +ac_cv_sizeof_off_t=`echo $ac_cv_sizeof_off_t | tr -d '\015'`
713 +ac_cv_sizeof_long=`echo $ac_cv_sizeof_long | tr -d '\015'`
714 +ac_cv_sizeof_long_long=`echo $ac_cv_sizeof_long_long | tr -d '\015'`
715 +ac_cv_sizeof_short=`echo $ac_cv_sizeof_short | tr -d '\015'`
716 { echo "$as_me:$LINENO: checking whether to enable large file support" >&5
717 echo $ECHO_N "checking whether to enable large file support... $ECHO_C" >&6; }
718 if test "$have_long_long" = yes -a \
719 @@ -12985,7 +12998,7 @@
724 + CYGWIN* | MINGW*) SO=.dll;;
728 @@ -13113,7 +13126,7 @@
730 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
731 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
732 - CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
733 + CYGWIN* | MINGW*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base ${LDFLAGS}";;
734 atheos*) LDSHARED="gcc -shared";;
737 @@ -13205,7 +13218,7 @@
738 LINKFORSHARED="-Xlinker --export-dynamic"
743 if test $enable_shared = "no"
745 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
746 @@ -13229,7 +13242,7 @@
747 if test ! "$LIBRARY" = "$LDLIBRARY"
749 case $ac_sys_system in
752 # Cygwin needs CCSHARED when building extension DLLs
753 # but not when building the interpreter DLL.
755 @@ -15443,7 +15456,7 @@
756 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
758 case $ac_sys_system in
762 cat >>confdefs.h <<\_ACEOF
763 #define HAVE_BROKEN_PTHREAD_SIGMASK 1
764 @@ -15457,6 +15470,17 @@
770 + THREADOBJ="Python/thread.o"
771 + USE_THREAD_MODULE="#"
772 + USE_PASSWORD_MODULE="#"
775 + USE_PASSWORD_MODULE=""
779 # Check for enable-ipv6
782 @@ -16057,6 +16081,11 @@
783 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
784 Darwin/[0156]\..*) DYNLOADFILE="dynload_next.o";;
785 atheos*) DYNLOADFILE="dynload_atheos.o";;
788 + winmingw*) DYNLOADFILE="dynload_win.o PC/import_nt.o PC/dl_nt.o";;
792 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
793 # out any dynamic loading
794 @@ -16078,6 +16107,21 @@
799 +{ echo "$as_me:$LINENO: checking GETPATH_OBJS" >&5
800 +echo $ECHO_N "checking GETPATH_OBJS... $ECHO_C" >&6; }
801 +if test -z "$GETPATH_OBJS"
805 + GETPATH_OBJS='PC/getpathp.o';;
807 + GETPATH_OBJS='Modules/getpath.o';;
810 +{ echo "$as_me:$LINENO: result: $GETPATH_OBJS" >&5
811 +echo "${ECHO_T}$GETPATH_OBJS" >&6; }
813 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
816 @@ -19952,6 +19996,112 @@
822 +{ echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5
823 +echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6; }
824 +if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then
825 + echo $ECHO_N "(cached) $ECHO_C" >&6
827 + cat >conftest.$ac_ext <<_ACEOF
830 +cat confdefs.h >>conftest.$ac_ext
831 +cat >>conftest.$ac_ext <<_ACEOF
832 +/* end confdefs.h. */
833 +$ac_includes_default
837 +static struct stat ac_aggr;
838 +if (ac_aggr.st_blocks)
844 +rm -f conftest.$ac_objext
845 +if { (ac_try="$ac_compile"
847 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
848 + *) ac_try_echo=$ac_try;;
850 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
851 + (eval "$ac_compile") 2>conftest.er1
853 + grep -v '^ *+' conftest.er1 >conftest.err
855 + cat conftest.err >&5
856 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
857 + (exit $ac_status); } && {
858 + test -z "$ac_c_werror_flag" ||
859 + test ! -s conftest.err
860 + } && test -s conftest.$ac_objext; then
861 + ac_cv_member_struct_stat_st_blocks=yes
863 + echo "$as_me: failed program was:" >&5
864 +sed 's/^/| /' conftest.$ac_ext >&5
866 + cat >conftest.$ac_ext <<_ACEOF
869 +cat confdefs.h >>conftest.$ac_ext
870 +cat >>conftest.$ac_ext <<_ACEOF
871 +/* end confdefs.h. */
872 +$ac_includes_default
876 +static struct stat ac_aggr;
877 +if (sizeof ac_aggr.st_blocks)
883 +rm -f conftest.$ac_objext
884 +if { (ac_try="$ac_compile"
886 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
887 + *) ac_try_echo=$ac_try;;
889 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
890 + (eval "$ac_compile") 2>conftest.er1
892 + grep -v '^ *+' conftest.er1 >conftest.err
894 + cat conftest.err >&5
895 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
896 + (exit $ac_status); } && {
897 + test -z "$ac_c_werror_flag" ||
898 + test ! -s conftest.err
899 + } && test -s conftest.$ac_objext; then
900 + ac_cv_member_struct_stat_st_blocks=yes
902 + echo "$as_me: failed program was:" >&5
903 +sed 's/^/| /' conftest.$ac_ext >&5
905 + ac_cv_member_struct_stat_st_blocks=no
908 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
911 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
913 +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blocks" >&5
914 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_blocks" >&6; }
915 +if test $ac_cv_member_struct_stat_st_blocks = yes; then
917 +cat >>confdefs.h <<_ACEOF
918 +#define HAVE_STRUCT_STAT_ST_BLOCKS 1
926 { echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5
927 echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6; }
928 if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then
929 @@ -20066,6 +20216,8 @@
936 { echo "$as_me:$LINENO: checking for time.h that defines altzone" >&5
937 echo $ECHO_N "checking for time.h that defines altzone... $ECHO_C" >&6; }
938 @@ -22530,6 +22682,7 @@
942 +ac_cv_sizeof_wchar_t=`echo $ac_cv_sizeof_wchar_t | tr -d '\015'`
944 if test "$enable_unicode" = "no"
946 @@ -25368,8 +25521,10 @@
947 USE_THREAD_MODULE!$USE_THREAD_MODULE$ac_delim
948 LDLAST!$LDLAST$ac_delim
949 THREADOBJ!$THREADOBJ$ac_delim
950 +USE_PASSWORD_MODULE!$USE_PASSWORD_MODULE$ac_delim
951 DLINCLDIR!$DLINCLDIR$ac_delim
952 DYNLOADFILE!$DYNLOADFILE$ac_delim
953 +GETPATH_OBJS!$GETPATH_OBJS$ac_delim
954 MACHDEP_OBJS!$MACHDEP_OBJS$ac_delim
956 LIBOBJS!$LIBOBJS$ac_delim
957 @@ -25386,7 +25541,7 @@
958 LTLIBOBJS!$LTLIBOBJS$ac_delim
961 - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 22; then
962 + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 24; then
964 elif $ac_last_try; then
965 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
966 --- misc/Python-2.6.1/configure.in 2008-11-16 17:02:56.000000000 +0900
967 +++ misc/build/Python-2.6.1/configure.in 2009-04-11 16:56:07.258750000 +0900
969 LDFLAGS="$SGI_ABI $LDFLAGS"
970 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
973 + *mingw*|*MINGW*|*MinGW*)
974 + MACHDEP="winmingw32"
975 + ac_sys_system=`uname -s`
976 + ac_sys_release=`uname -r`
979 AC_MSG_RESULT($MACHDEP)
981 # And add extra plat-mac for darwin
983 if test -z "$enable_shared"
985 case $ac_sys_system in
987 + CYGWIN* | MINGW* | atheos*)
988 enable_shared="yes";;
993 LDLIBRARY='libpython$(VERSION).so'
997 LDLIBRARY='libpython$(VERSION).dll.a'
998 DLLLIBRARY='libpython$(VERSION).dll'
1002 else # shared is disabled
1003 case $ac_sys_system in
1006 BLDLIBRARY='$(LIBRARY)'
1007 LDLIBRARY='libpython$(VERSION).dll.a'
1009 @@ -1402,6 +1409,10 @@
1010 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
1011 [The number of bytes in an off_t.])
1013 +ac_cv_sizeof_off_t=`echo $ac_cv_sizeof_off_t | tr -d '\015'`
1014 +ac_cv_sizeof_long=`echo $ac_cv_sizeof_long | tr -d '\015'`
1015 +ac_cv_sizeof_long_long=`echo $ac_cv_sizeof_long_long | tr -d '\015'`
1016 +ac_cv_sizeof_short=`echo $ac_cv_sizeof_short | tr -d '\015'`
1017 AC_MSG_CHECKING(whether to enable large file support)
1018 if test "$have_long_long" = yes -a \
1019 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1020 @@ -1581,7 +1592,7 @@
1024 - CYGWIN*) SO=.dll;;
1025 + CYGWIN* | MINGW*) SO=.dll;;
1029 @@ -1703,7 +1714,7 @@
1031 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
1032 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
1033 - CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
1034 + CYGWIN* | MINGW*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base ${LDFLAGS}";;
1035 atheos*) LDSHARED="gcc -shared";;
1038 @@ -1791,7 +1802,7 @@
1039 LINKFORSHARED="-Xlinker --export-dynamic"
1044 if test $enable_shared = "no"
1046 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1047 @@ -1813,7 +1824,7 @@
1048 if test ! "$LIBRARY" = "$LDLIBRARY"
1050 case $ac_sys_system in
1053 # Cygwin needs CCSHARED when building extension DLLs
1054 # but not when building the interpreter DLL.
1055 CFLAGSFORSHARED='';;
1056 @@ -2149,13 +2160,24 @@
1058 AC_CHECK_FUNCS(pthread_sigmask,
1059 [case $ac_sys_system in
1062 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
1063 [Define if pthread_sigmask() does not work on your system.])
1068 +AC_SUBST(USE_PASSWORD_MODULE)
1071 + THREADOBJ="Python/thread.o"
1072 + USE_THREAD_MODULE="#"
1073 + USE_PASSWORD_MODULE="#"
1076 + USE_PASSWORD_MODULE=""
1080 # Check for enable-ipv6
1081 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
1082 @@ -2415,6 +2437,11 @@
1083 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
1084 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
1085 atheos*) DYNLOADFILE="dynload_atheos.o";;
1088 + winmingw*) DYNLOADFILE="dynload_win.o PC/import_nt.o PC/dl_nt.o";;
1092 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1093 # out any dynamic loading
1094 @@ -2432,6 +2459,19 @@
1095 [Defined when any dynamic module loading is enabled.])
1098 +AC_SUBST(GETPATH_OBJS)
1099 +AC_MSG_CHECKING(GETPATH_OBJS)
1100 +if test -z "$GETPATH_OBJS"
1104 + GETPATH_OBJS='PC/getpathp.o';;
1106 + GETPATH_OBJS='Modules/getpath.o';;
1109 +AC_MSG_RESULT($GETPATH_OBJS)
1111 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
1113 AC_SUBST(MACHDEP_OBJS)
1114 @@ -2862,7 +2902,14 @@
1115 AC_CHECK_MEMBERS([struct stat.st_flags])
1116 AC_CHECK_MEMBERS([struct stat.st_gen])
1117 AC_CHECK_MEMBERS([struct stat.st_birthtime])
1120 +AC_CHECK_MEMBERS([struct stat.st_blocks])
1127 AC_MSG_CHECKING(for time.h that defines altzone)
1128 AC_CACHE_VAL(ac_cv_header_time_altzone,
1129 @@ -3247,6 +3294,7 @@
1130 AH_TEMPLATE(PY_UNICODE_TYPE,
1131 [Define as the integral type used for Unicode representation.])
1133 +ac_cv_sizeof_wchar_t=`echo $ac_cv_sizeof_wchar_t | tr -d '\015'`
1134 AC_SUBST(UNICODE_OBJS)
1135 if test "$enable_unicode" = "no"
1137 --- misc/Python-2.6.1/setup.py 2008-11-05 05:43:31.000000000 +0900
1138 +++ misc/build/Python-2.6.1/setup.py 2009-04-12 16:02:22.654125000 +0900
1139 @@ -234,6 +234,18 @@
1140 if not self.configure_ctypes(ext):
1143 + if self.get_platform() == "winmingw":
1144 + if ext.name == '_ctypes_test':
1145 + ext.libraries.append('oleaut32')
1146 + elif ext.name == 'select':
1147 + ext.libraries.append('ws2_32')
1148 + elif ext.name == '_socket':
1149 + ext.libraries.append('ws2_32')
1150 + if ext.name == '_ctypes':
1151 + ext.libraries.append('uuid')
1152 + ext.libraries.append('oleaut32')
1153 + ext.libraries.append('ole32')
1156 build_ext.build_extension(self, ext)
1157 except (CCompilerError, DistutilsError), why:
1160 # Workaround for Cygwin: Cygwin currently has fork issues when many
1161 # modules have been imported
1162 - if self.get_platform() == 'cygwin':
1163 + if self.get_platform() in ['cygwin', 'winmingw']:
1164 self.announce('WARNING: skipping import check for Cygwin-based "%s"'
1169 def get_platform(self):
1170 # Get value of sys.platform
1171 - for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
1172 + for platform in ['cygwin', 'winmingw', 'beos', 'darwin', 'atheos', 'osf1']:
1173 if sys.platform.startswith(platform):
1176 @@ -1009,7 +1021,7 @@
1177 missing.append('bsddb185')
1179 # The standard Unix dbm module:
1180 - if platform not in ['cygwin']:
1181 + if platform not in ['cygwin', 'winmingw']:
1182 if find_file("ndbm.h", inc_dirs, []) is not None:
1183 # Some systems have -lndbm, others don't
1184 if self.compiler.find_library_file(lib_dirs, 'ndbm'):
1185 @@ -1053,7 +1065,7 @@
1186 missing.append('resource')
1188 # Sun yellow pages. Some systems have the functions in libc.
1189 - if platform not in ['cygwin', 'atheos', 'qnx6']:
1190 + if platform not in ['cygwin', 'winmingw', 'atheos', 'qnx6']:
1191 if (self.compiler.find_library_file(lib_dirs, 'nsl')):
1194 @@ -1252,14 +1264,14 @@
1198 - elif platform == 'cygwin': # Cygwin
1199 + elif platform in ['cygwin', 'winmingw']: # Cygwin
1202 HAVE_SEM_TIMEDWAIT=1,
1204 HAVE_BROKEN_SEM_UNLINK=1
1207 + libraries = ['ws2_32']
1209 elif platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
1210 # FreeBSD's P1003.1b semaphore support is very experimental
1211 @@ -1287,7 +1299,7 @@
1215 - if platform == 'win32':
1216 + if platform in ['win32', 'winmingw']:
1217 multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c',
1218 '_multiprocessing/semaphore.c',
1219 '_multiprocessing/pipe_connection.c',
1220 @@ -1305,6 +1317,7 @@
1222 exts.append ( Extension('_multiprocessing', multiprocessing_srcs,
1223 define_macros=macros.items(),
1224 + libraries=libraries,
1225 include_dirs=["Modules/_multiprocessing"]))
1226 # End multiprocessing
1228 @@ -1423,6 +1436,10 @@
1229 '-framework', 'Carbon']) )
1232 + if platform == 'winmingw':
1233 + exts.append( Extension('_winreg', ['../PC/_winreg.c']) )
1234 + exts.append( Extension('winsound', ['../PC/winsound.c'], libraries = ['winmm']) )
1236 self.extensions.extend(exts)
1238 # Call the method for detecting whether _tkinter can be compiled
1239 @@ -1575,7 +1592,7 @@
1240 added_lib_dirs.append('/usr/X11/lib')
1242 # If Cygwin, then verify that X is installed before proceeding
1243 - if platform == 'cygwin':
1244 + if platform in ['cygwin', 'winmingw']:
1245 x11_inc = find_file('X11/Xlib.h', [], include_dirs)
1248 @@ -1598,7 +1615,7 @@
1251 # Finally, link with the X11 libraries (not appropriate on cygwin)
1252 - if platform != "cygwin":
1253 + if not platform in ["cygwin", "winmingw"]:
1256 ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
1257 @@ -1669,6 +1686,8 @@
1258 from distutils.dir_util import mkpath
1259 mkpath(ffi_builddir)
1261 + if self.get_platform() == "winmingw":
1262 + config_args.append(" --build=mingw32")
1264 # Pass empty CFLAGS because we'll just append the resulting
1265 # CFLAGS to Python's; -g or -O2 is to be avoided.