add script to build python
[msysgit.git] / src / python / patches / 0001-dirty-patch.patch
blob6b32768f60f580b5479eb4260f535bf845e9d15a
1 From 2eba3794fc214f8f471ae2563ddb0f5a5df610dc Mon Sep 17 00:00:00 2001
2 From: Erik Faye-Lund <kusmabite@gmail.com>
3 Date: Tue, 9 Oct 2012 22:48:36 +0200
4 Subject: [PATCH] dirty patch
6 ---
7 Makefile.pre.in | 11 +-
8 Modules/Setup | 506 ++++++++++++++++++++++++++++++++++++++++++++++++++
9 Modules/posixmodule.c | 35 ++--
10 PC/_winreg.c | 16 ++
11 PC/import_nt.c | 2 +-
12 Python/dynload_win.c | 3 +-
13 Python/random.c | 7 +
14 configure | 12 +-
15 8 files changed, 563 insertions(+), 29 deletions(-)
16 create mode 100644 Modules/Setup
18 diff --git a/Makefile.pre.in b/Makefile.pre.in
19 index e2237a9..966a915 100644
20 --- a/Makefile.pre.in
21 +++ b/Makefile.pre.in
22 @@ -193,8 +193,8 @@ PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
23 ##########################################################################
24 # Modules
25 MODULE_OBJS= \
26 - Modules/config.o \
27 - Modules/getpath.o \
28 + PC/config.o \
29 + PC/getpathp.o \
30 Modules/main.o \
31 Modules/gcmodule.o
33 @@ -301,7 +301,8 @@ PYTHON_OBJS= \
34 Python/dtoa.o \
35 Python/formatter_unicode.o \
36 Python/formatter_string.o \
37 - Python/$(DYNLOADFILE) \
38 + Python/dynload_win.o \
39 + PC/dl_nt.o \
40 $(LIBOBJS) \
41 $(MACHDEP_OBJS) \
42 $(THREADOBJ)
43 @@ -396,9 +397,9 @@ coverage:
46 # Build the interpreter
47 -$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
48 +$(BUILDPYTHON): Modules/python.o PC/import_nt.o $(LIBRARY) $(LDLIBRARY)
49 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
50 - Modules/python.o \
51 + Modules/python.o PC/import_nt.o \
52 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
54 platform: $(BUILDPYTHON)
55 diff --git a/Modules/Setup b/Modules/Setup
56 new file mode 100644
57 index 0000000..2daecba
58 --- /dev/null
59 +++ b/Modules/Setup
60 @@ -0,0 +1,506 @@
61 +# -*- makefile -*-
62 +# The file Setup is used by the makesetup script to construct the files
63 +# Makefile and config.c, from Makefile.pre and config.c.in,
64 +# respectively. The file Setup itself is initially copied from
65 +# Setup.dist; once it exists it will not be overwritten, so you can edit
66 +# Setup to your heart's content. Note that Makefile.pre is created
67 +# from Makefile.pre.in by the toplevel configure script.
69 +# (VPATH notes: Setup and Makefile.pre are in the build directory, as
70 +# are Makefile and config.c; the *.in and *.dist files are in the source
71 +# directory.)
73 +# Each line in this file describes one or more optional modules.
74 +# Modules enabled here will not be compiled by the setup.py script,
75 +# so the file can be used to override setup.py's behavior.
77 +# Lines have the following structure:
79 +# <module> ... [<sourcefile> ...] [<cpparg> ...] [<library> ...]
81 +# <sourcefile> is anything ending in .c (.C, .cc, .c++ are C++ files)
82 +# <cpparg> is anything starting with -I, -D, -U or -C
83 +# <library> is anything ending in .a or beginning with -l or -L
84 +# <module> is anything else but should be a valid Python
85 +# identifier (letters, digits, underscores, beginning with non-digit)
87 +# (As the makesetup script changes, it may recognize some other
88 +# arguments as well, e.g. *.so and *.sl as libraries. See the big
89 +# case statement in the makesetup script.)
91 +# Lines can also have the form
93 +# <name> = <value>
95 +# which defines a Make variable definition inserted into Makefile.in
97 +# Finally, if a line contains just the word "*shared*" (without the
98 +# quotes but with the stars), then the following modules will not be
99 +# built statically. The build process works like this:
101 +# 1. Build all modules that are declared as static in Modules/Setup,
102 +# combine them into libpythonxy.a, combine that into python.
103 +# 2. Build all modules that are listed as shared in Modules/Setup.
104 +# 3. Invoke setup.py. That builds all modules that
105 +# a) are not builtin, and
106 +# b) are not listed in Modules/Setup, and
107 +# c) can be build on the target
109 +# Therefore, modules declared to be shared will not be
110 +# included in the config.c file, nor in the list of objects to be
111 +# added to the library archive, and their linker options won't be
112 +# added to the linker options. Rules to create their .o files and
113 +# their shared libraries will still be added to the Makefile, and
114 +# their names will be collected in the Make variable SHAREDMODS. This
115 +# is used to build modules as shared libraries. (They can be
116 +# installed using "make sharedinstall", which is implied by the
117 +# toplevel "make install" target.) (For compatibility,
118 +# *noconfig* has the same effect as *shared*.)
120 +# In addition, *static* explicitly declares the following modules to
121 +# be static. Lines containing "*static*" and "*shared*" may thus
122 +# alternate throughout this file.
124 +# NOTE: As a standard policy, as many modules as can be supported by a
125 +# platform should be present. The distribution comes with all modules
126 +# enabled that are supported by most platforms and don't require you
127 +# to ftp sources from elsewhere.
130 +# Some special rules to define PYTHONPATH.
131 +# Edit the definitions below to indicate which options you are using.
132 +# Don't add any whitespace or comments!
134 +# Directories where library files get installed.
135 +# DESTLIB is for Python modules; MACHDESTLIB for shared libraries.
136 +DESTLIB=$(LIBDEST)
137 +MACHDESTLIB=$(BINLIBDEST)
139 +# NOTE: all the paths are now relative to the prefix that is computed
140 +# at run time!
142 +# Standard path -- don't edit.
143 +# No leading colon since this is the first entry.
144 +# Empty since this is now just the runtime prefix.
145 +DESTPATH=
147 +# Site specific path components -- should begin with : if non-empty
148 +SITEPATH=
150 +# Standard path components for test modules
151 +TESTPATH=
153 +# Path components for machine- or system-dependent modules and shared libraries
154 +MACHDEPPATH=:plat-$(MACHDEP)
155 +EXTRAMACHDEPPATH=
157 +# Path component for the Tkinter-related modules
158 +# The TKPATH variable is always enabled, to save you the effort.
159 +TKPATH=:lib-tk
161 +# Path component for old modules.
162 +OLDPATH=:lib-old
164 +COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH)$(MACHDEPPATH)$(EXTRAMACHDEPPATH)$(TKPATH)$(OLDPATH)
165 +PYTHONPATH=$(COREPYTHONPATH)
168 +# The modules listed here can't be built as shared libraries for
169 +# various reasons; therefore they are listed here instead of in the
170 +# normal order.
172 +# This only contains the minimal set of modules required to run the
173 +# setup.py script in the root of the Python source tree.
175 +posix posixmodule.c # posix (UNIX) system calls
176 +errno errnomodule.c # posix (UNIX) errno values
177 +# pwd pwdmodule.c # this is needed to find out the user's home dir
178 + # if $HOME is not set
179 +_sre _sre.c # Fredrik Lundh's new regular expressions
180 +_codecs _codecsmodule.c # access to the builtin codecs and codec registry
181 +_weakref _weakref.c # weak references
183 +# The zipimport module is always imported at startup. Having it as a
184 +# builtin module avoids some bootstrapping problems and reduces overhead.
185 +zipimport zipimport.c
187 +# The rest of the modules listed in this file are all commented out by
188 +# default. Usually they can be detected and built as dynamically
189 +# loaded modules by the new setup.py script added in Python 2.1. If
190 +# you're on a platform that doesn't support dynamic loading, want to
191 +# compile modules statically into the Python binary, or need to
192 +# specify some odd set of compiler switches, you can uncomment the
193 +# appropriate lines below.
195 +# ======================================================================
197 +# The Python symtable module depends on .h files that setup.py doesn't track
198 +_symtable symtablemodule.c
200 +# The SGI specific GL module:
202 +GLHACK=-Dclear=__GLclear
203 +#gl glmodule.c cgensupport.c -I$(srcdir) $(GLHACK) -lgl -lX11
205 +# Pure module. Cannot be linked dynamically.
206 +# -DWITH_QUANTIFY, -DWITH_PURIFY, or -DWITH_ALL_PURE
207 +#WHICH_PURE_PRODUCTS=-DWITH_ALL_PURE
208 +#PURE_INCLS=-I/usr/local/include
209 +#PURE_STUBLIBS=-L/usr/local/lib -lpurify_stubs -lquantify_stubs
210 +#pure puremodule.c $(WHICH_PURE_PRODUCTS) $(PURE_INCLS) $(PURE_STUBLIBS)
212 +# Uncommenting the following line tells makesetup that all following
213 +# modules are to be built as shared libraries (see above for more
214 +# detail; also note that *static* reverses this effect):
216 +#*shared*
218 +# GNU readline. Unlike previous Python incarnations, GNU readline is
219 +# now incorporated in an optional module, configured in the Setup file
220 +# instead of by a configure script switch. You may have to insert a
221 +# -L option pointing to the directory where libreadline.* lives,
222 +# and you may have to change -ltermcap to -ltermlib or perhaps remove
223 +# it, depending on your system -- see the GNU readline instructions.
224 +# It's okay for this to be a shared library, too.
226 +#readline readline.c -lreadline -ltermcap
229 +# Modules that should always be present (non UNIX dependent):
231 +array arraymodule.c # array objects
232 +cmath cmathmodule.c _math.c # -lm # complex math library functions
233 +math mathmodule.c _math.c # -lm # math library functions, e.g. sin()
234 +_struct _struct.c # binary structure packing/unpacking
235 +time timemodule.c # -lm # time operations and variables
236 +operator operator.c # operator.add() and similar goodies
237 +#_testcapi _testcapimodule.c # Python C API test module
238 +_random _randommodule.c # Random number generator
239 +_collections _collectionsmodule.c # Container types
240 +itertools itertoolsmodule.c # Functions creating iterators for efficient looping
241 +strop stropmodule.c # String manipulations
242 +_functools _functoolsmodule.c # Tools for working with functions and callable objects
243 +#_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator
244 +#_pickle _pickle.c # pickle accelerator
245 +datetime datetimemodule.c # date/time type
246 +_bisect _bisectmodule.c # Bisection algorithms
248 +#unicodedata unicodedata.c # static Unicode character database
250 +# access to ISO C locale support
251 +_locale _localemodule.c # -lintl
254 +# Modules with some UNIX dependencies -- on by default:
255 +# (If you have a really backward UNIX, select and socket may not be
256 +# supported...)
258 +#fcntl fcntlmodule.c # fcntl(2) and ioctl(2)
259 +#spwd spwdmodule.c # spwd(3)
260 +#grp grpmodule.c # grp(3)
261 +#select selectmodule.c # select(2); not on ancient System V
263 +# Memory-mapped files (also works on Win32).
264 +mmap mmapmodule.c
266 +# CSV file helper
267 +_csv _csv.c
269 +# Socket module helper for socket(2)
270 +#_socket socketmodule.c
272 +# Socket module helper for SSL support; you must comment out the other
273 +# socket line above, and possibly edit the SSL variable:
274 +#SSL=/usr/local/ssl
275 +#_ssl _ssl.c \
276 +# -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
277 +# -L$(SSL)/lib -lssl -lcrypto
279 +# The crypt module is now disabled by default because it breaks builds
280 +# on many systems (where -lcrypt is needed), e.g. Linux (I believe).
282 +# First, look at Setup.config; configure may have set this for you.
284 +#crypt cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems
287 +# Some more UNIX dependent modules -- off by default, since these
288 +# are not supported by all UNIX systems:
290 +#nis nismodule.c -lnsl # Sun yellow pages -- not everywhere
291 +#termios termios.c # Steen Lumholt's termios module
292 +#resource resource.c # Jeremy Hylton's rlimit interface
295 +# Multimedia modules -- off by default.
296 +# These don't work for 64-bit platforms!!!
297 +# #993173 says audioop works on 64-bit platforms, though.
298 +# These represent audio samples or images as strings:
300 +audioop audioop.c # Operations on audio samples
301 +imageop imageop.c # Operations on images
304 +# Note that the _md5 and _sha modules are normally only built if the
305 +# system does not have the OpenSSL libs containing an optimized version.
307 +# The _md5 module implements the RSA Data Security, Inc. MD5
308 +# Message-Digest Algorithm, described in RFC 1321. The necessary files
309 +# md5.c and md5.h are included here.
311 +_md5 md5module.c md5.c
314 +# The _sha module implements the SHA checksum algorithms.
315 +# (NIST's Secure Hash Algorithms.)
316 +_sha shamodule.c
317 +_sha256 sha256module.c
318 +_sha512 sha512module.c
321 +# SGI IRIX specific modules -- off by default.
323 +# These module work on any SGI machine:
325 +# *** gl must be enabled higher up in this file ***
326 +#fm fmmodule.c $(GLHACK) -lfm -lgl # Font Manager
327 +#sgi sgimodule.c # sgi.nap() and a few more
329 +# This module requires the header file
330 +# /usr/people/4Dgifts/iristools/include/izoom.h:
331 +#imgfile imgfile.c -limage -lgutil -lgl -lm # Image Processing Utilities
334 +# These modules require the Multimedia Development Option (I think):
336 +#al almodule.c -laudio # Audio Library
337 +#cd cdmodule.c -lcdaudio -lds -lmediad # CD Audio Library
338 +#cl clmodule.c -lcl -lawareaudio # Compression Library
339 +#sv svmodule.c yuvconvert.c -lsvideo -lXext -lX11 # Starter Video
342 +# The FORMS library, by Mark Overmars, implements user interface
343 +# components such as dialogs and buttons using SGI's GL and FM
344 +# libraries. You must ftp the FORMS library separately from
345 +# ftp://ftp.cs.ruu.nl/pub/SGI/FORMS. It was tested with FORMS 2.2a.
346 +# NOTE: if you want to be able to use FORMS and curses simultaneously
347 +# (or both link them statically into the same binary), you must
348 +# compile all of FORMS with the cc option "-Dclear=__GLclear".
350 +# The FORMS variable must point to the FORMS subdirectory of the forms
351 +# toplevel directory:
353 +#FORMS=/ufs/guido/src/forms/FORMS
354 +#fl flmodule.c -I$(FORMS) $(GLHACK) $(FORMS)/libforms.a -lfm -lgl
357 +# SunOS specific modules -- off by default:
359 +#sunaudiodev sunaudiodev.c
362 +# A Linux specific module -- off by default; this may also work on
363 +# some *BSDs.
365 +#linuxaudiodev linuxaudiodev.c
368 +# George Neville-Neil's timing module:
370 +#timing timingmodule.c
373 +# The _tkinter module.
375 +# The command for _tkinter is long and site specific. Please
376 +# uncomment and/or edit those parts as indicated. If you don't have a
377 +# specific extension (e.g. Tix or BLT), leave the corresponding line
378 +# commented out. (Leave the trailing backslashes in! If you
379 +# experience strange errors, you may want to join all uncommented
380 +# lines and remove the backslashes -- the backslash interpretation is
381 +# done by the shell's "read" command and it may not be implemented on
382 +# every system.
384 +# *** Always uncomment this (leave the leading underscore in!):
385 +# _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
386 +# *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
387 +# -L/usr/local/lib \
388 +# *** Uncomment and edit to reflect where your Tcl/Tk headers are:
389 +# -I/usr/local/include \
390 +# *** Uncomment and edit to reflect where your X11 header files are:
391 +# -I/usr/X11R6/include \
392 +# *** Or uncomment this for Solaris:
393 +# -I/usr/openwin/include \
394 +# *** Uncomment and edit for Tix extension only:
395 +# -DWITH_TIX -ltix8.1.8.2 \
396 +# *** Uncomment and edit for BLT extension only:
397 +# -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
398 +# *** Uncomment and edit for PIL (TkImaging) extension only:
399 +# (See http://www.pythonware.com/products/pil/ for more info)
400 +# -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \
401 +# *** Uncomment and edit for TOGL extension only:
402 +# -DWITH_TOGL togl.c \
403 +# *** Uncomment and edit to reflect your Tcl/Tk versions:
404 +# -ltk8.2 -ltcl8.2 \
405 +# *** Uncomment and edit to reflect where your X11 libraries are:
406 +# -L/usr/X11R6/lib \
407 +# *** Or uncomment this for Solaris:
408 +# -L/usr/openwin/lib \
409 +# *** Uncomment these for TOGL extension only:
410 +# -lGL -lGLU -lXext -lXmu \
411 +# *** Uncomment for AIX:
412 +# -lld \
413 +# *** Always uncomment this; X11 libraries to link with:
414 +# -lX11
416 +# Lance Ellinghaus's syslog module
417 +#syslog syslogmodule.c # syslog daemon interface
420 +# Curses support, requring the System V version of curses, often
421 +# provided by the ncurses library. e.g. on Linux, link with -lncurses
422 +# instead of -lcurses).
424 +# First, look at Setup.config; configure may have set this for you.
426 +#_curses _cursesmodule.c -lcurses -ltermcap
427 +# Wrapper for the panel library that's part of ncurses and SYSV curses.
428 +#_curses_panel _curses_panel.c -lpanel -lncurses
431 +# Generic (SunOS / SVR4) dynamic loading module.
432 +# This is not needed for dynamic loading of Python modules --
433 +# it is a highly experimental and dangerous device for calling
434 +# *arbitrary* C functions in *arbitrary* shared libraries:
436 +#dl dlmodule.c
439 +# Modules that provide persistent dictionary-like semantics. You will
440 +# probably want to arrange for at least one of them to be available on
441 +# your machine, though none are defined by default because of library
442 +# dependencies. The Python module anydbm.py provides an
443 +# implementation independent wrapper for these; dumbdbm.py provides
444 +# similar functionality (but slower of course) implemented in Python.
446 +# The standard Unix dbm module has been moved to Setup.config so that
447 +# it will be compiled as a shared library by default. Compiling it as
448 +# a built-in module causes conflicts with the pybsddb3 module since it
449 +# creates a static dependency on an out-of-date version of db.so.
451 +# First, look at Setup.config; configure may have set this for you.
453 +#dbm dbmmodule.c # dbm(3) may require -lndbm or similar
455 +# Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
457 +# First, look at Setup.config; configure may have set this for you.
459 +#gdbm gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm
462 +# Sleepycat Berkeley DB interface.
464 +# This requires the Sleepycat DB code, see http://www.sleepycat.com/
465 +# The earliest supported version of that library is 3.0, the latest
466 +# supported version is 4.0 (4.1 is specifically not supported, as that
467 +# changes the semantics of transactional databases). A list of available
468 +# releases can be found at
470 +# http://www.sleepycat.com/update/index.html
472 +# Edit the variables DB and DBLIBVERto point to the db top directory
473 +# and the subdirectory of PORT where you built it.
474 +#DB=/usr/local/BerkeleyDB.4.0
475 +#DBLIBVER=4.0
476 +#DBINC=$(DB)/include
477 +#DBLIB=$(DB)/lib
478 +#_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
480 +# Historical Berkeley DB 1.85
482 +# This module is deprecated; the 1.85 version of the Berkeley DB library has
483 +# bugs that can cause data corruption. If you can, use later versions of the
484 +# library instead, available from <http://www.sleepycat.com/>.
486 +#DB=/depot/sundry/src/berkeley-db/db.1.85
487 +#DBPORT=$(DB)/PORT/irix.5.3
488 +#bsddb185 bsddbmodule.c -I$(DBPORT)/include -I$(DBPORT) $(DBPORT)/libdb.a
492 +# Helper module for various ascii-encoders
493 +binascii binascii.c
495 +# Fred Drake's interface to the Python parser
496 +parser parsermodule.c
498 +# cStringIO and cPickle
499 +cStringIO cStringIO.c
500 +cPickle cPickle.c
503 +# Lee Busby's SIGFPE modules.
504 +# The library to link fpectl with is platform specific.
505 +# Choose *one* of the options below for fpectl:
507 +# For SGI IRIX (tested on 5.3):
508 +#fpectl fpectlmodule.c -lfpe
510 +# For Solaris with SunPro compiler (tested on Solaris 2.5 with SunPro C 4.2):
511 +# (Without the compiler you don't have -lsunmath.)
512 +#fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm
514 +# For other systems: see instructions in fpectlmodule.c.
515 +#fpectl fpectlmodule.c ...
517 +# Test module for fpectl. No extra libraries needed.
518 +#fpetest fpetestmodule.c
520 +# Andrew Kuchling's zlib module.
521 +# This require zlib 1.1.3 (or later).
522 +# See http://www.gzip.org/zlib/
523 +zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
525 +# Interface to the Expat XML parser
527 +# Expat was written by James Clark and is now maintained by a group of
528 +# developers on SourceForge; see www.libexpat.org for more
529 +# information. The pyexpat module was written by Paul Prescod after a
530 +# prototype by Jack Jansen. Source of Expat 1.95.2 is included in
531 +# Modules/expat/. Usage of a system shared libexpat.so/expat.dll is
532 +# not advised.
534 +# More information on Expat can be found at www.libexpat.org.
536 +#pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI
539 +# Hye-Shik Chang's CJKCodecs
541 +# multibytecodec is required for all the other CJK codec modules
542 +_multibytecodec cjkcodecs/multibytecodec.c
544 +_codecs_cn cjkcodecs/_codecs_cn.c
545 +_codecs_hk cjkcodecs/_codecs_hk.c
546 +_codecs_iso2022 cjkcodecs/_codecs_iso2022.c
547 +_codecs_jp cjkcodecs/_codecs_jp.c
548 +_codecs_kr cjkcodecs/_codecs_kr.c
549 +_codecs_tw cjkcodecs/_codecs_tw.c
551 +# Example -- included for reference only:
552 +# xx xxmodule.c
554 +# Another example -- the 'xxsubtype' module shows C-level subtyping in action
555 +xxsubtype xxsubtype.c
558 +future_builtins future_builtins.c
559 +_hotshot _hotshot.c
560 +_json _json.c
561 +_heapq _heapqmodule.c
562 +_lsprof _lsprof.c rotatingtree.c
563 +_io _io/_iomodule.c _io/stringio.c _io/bytesio.c _io/textio.c _io/fileio.c _io/bufferedio.c _io/iobase.c
564 +_winred ../PC/_winreg.c
565 +_subprocess ../PC/_subprocess.c
566 +msvcrt ../PC/msvcrtmodule.c
567 diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
568 index 1bd5c1a..2147f4e 100644
569 --- a/Modules/posixmodule.c
570 +++ b/Modules/posixmodule.c
571 @@ -118,7 +118,7 @@ corresponding Unix manual entries for more information on calls.");
572 #define HAVE_SYSTEM 1
573 #define HAVE_WAIT 1
574 #else
575 -#ifdef _MSC_VER /* Microsoft compiler */
576 +#if defined(_MSC_VER) || defined(__MINGW32__) /* Win32 compiler */
577 #define HAVE_GETCWD 1
578 #define HAVE_SPAWNV 1
579 #define HAVE_EXECV 1
580 @@ -171,7 +171,7 @@ extern char *ctermid_r(char *);
581 #if defined(PYCC_VACPP)
582 extern int mkdir(char *);
583 #else
584 -#if ( defined(__WATCOMC__) || defined(_MSC_VER) ) && !defined(__QNX__)
585 +#if ( defined(__WATCOMC__) || defined(_MSC_VER) ) && !defined(__QNX__) || defined(__MINGW32__)
586 extern int mkdir(const char *);
587 #else
588 extern int mkdir(const char *, mode_t);
589 @@ -184,7 +184,7 @@ extern int rmdir(char *);
590 extern int chdir(const char *);
591 extern int rmdir(const char *);
592 #endif
593 -#ifdef __BORLANDC__
594 +#if defined(__BORLANDC__) || defined(__MINGW32__)
595 extern int chmod(const char *, int);
596 #else
597 extern int chmod(const char *, mode_t);
598 @@ -195,7 +195,11 @@ extern int fchmod(int, mode_t);
599 /*#ifdef HAVE_LCHMOD
600 extern int lchmod(const char *, mode_t);
601 #endif*/
602 +#ifdef __MINGW32__
603 +extern int chown(const char *, int, int);
604 +#else
605 extern int chown(const char *, uid_t, gid_t);
606 +#endif
607 extern char *getcwd(char *, int);
608 extern char *strerror(int);
609 extern int link(const char *, const char *);
610 @@ -256,7 +260,7 @@ extern int lstat(const char *, struct stat *);
611 #endif
612 #endif
614 -#ifdef _MSC_VER
615 +#if defined(_MSC_VER) || defined(__MINGW32__)
616 #ifdef HAVE_DIRECT_H
617 #include <direct.h>
618 #endif
619 @@ -447,7 +451,7 @@ _PyVerify_fd_dup2(int fd1, int fd2)
621 #include <crt_externs.h>
622 static char **environ;
623 -#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
624 +#elif !defined(_MSC_VER) && !defined(__MINGW32__) && ( !defined(__WATCOMC__) || defined(__QNX__) )
625 extern char **environ;
626 #endif /* !_MSC_VER */
628 @@ -544,7 +548,7 @@ posix_error_with_allocated_filename(char* name)
630 #ifdef MS_WINDOWS
631 static PyObject *
632 -win32_error(char* function, char* filename)
633 +win32_error(const char* function, char* filename)
635 /* XXX We should pass the function name along in the future.
636 (_winreg.c also wants to pass the function name.)
637 @@ -559,7 +563,7 @@ win32_error(char* function, char* filename)
640 static PyObject *
641 -win32_error_unicode(char* function, Py_UNICODE* filename)
642 +win32_error_unicode(const char* function, Py_UNICODE* filename)
644 /* XXX - see win32_error for comments on 'function' */
645 errno = GetLastError();
646 @@ -729,9 +733,9 @@ posix_2str(PyObject *args,
648 #ifdef MS_WINDOWS
649 static PyObject*
650 -win32_1str(PyObject* args, char* func,
651 - char* format, BOOL (__stdcall *funcA)(LPCSTR),
652 - char* wformat, BOOL (__stdcall *funcW)(LPWSTR))
653 +win32_1str(PyObject* args, const char* func,
654 + const char* format, BOOL (__stdcall *funcA)(LPCSTR),
655 + const char* wformat, BOOL (__stdcall *funcW)(LPCWSTR))
657 PyObject *uni;
658 char *ansi;
659 @@ -766,7 +770,7 @@ win32_1str(PyObject* args, char* func,
660 it also needs to set "magic" environment variables indicating
661 the per-drive current directory, which are of the form =<drive>: */
662 static BOOL __stdcall
663 -win32_chdir(LPCSTR path)
664 +win32_chdir(const LPCSTR path)
666 char new_path[MAX_PATH+1];
667 int result;
668 @@ -866,7 +870,7 @@ struct win32_stat{
669 int st_ctime_nsec;
672 -static __int64 secs_between_epochs = 11644473600; /* Seconds between 1.1.1601 and 1.1.1970 */
673 +static __int64 secs_between_epochs = 11644473600ll; /* Seconds between 1.1.1601 and 1.1.1970 */
675 static void
676 FILE_TIME_to_time_t_nsec(FILETIME *in_ptr, time_t *time_out, int* nsec_out)
677 @@ -6997,10 +7001,9 @@ posix_putenv(PyObject *self, PyObject *args)
678 /* XXX This can leak memory -- not easy to fix :-( */
679 len = strlen(s1) + strlen(s2) + 2;
680 #ifdef MS_WINDOWS
681 - if (_MAX_ENV < (len - 1)) {
682 + if (32767 < (len - 1)) {
683 PyErr_Format(PyExc_ValueError,
684 - "the environment variable is longer than %u bytes",
685 - _MAX_ENV);
686 + "the environment variable is longer than 32767 bytes");
687 return NULL;
689 #endif
690 @@ -9251,7 +9254,7 @@ all_ins(PyObject *d)
694 -#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__)
695 +#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__MINGW32__) || defined(__BORLANDC__)) && !defined(__QNX__)
696 #define INITFUNC initnt
697 #define MODNAME "nt"
699 diff --git a/PC/_winreg.c b/PC/_winreg.c
700 index 445c3ed..c0bcd8b 100644
701 --- a/PC/_winreg.c
702 +++ b/PC/_winreg.c
703 @@ -16,6 +16,22 @@
704 #include "structmember.h"
705 #include "malloc.h" /* for alloca */
706 #include "windows.h"
707 +#include "stdlib.h"
709 +#ifdef __MINGW32__
710 +extern size_t _mbstrlen(const char *);
711 +#define KEY_WOW64_64KEY 0x0100
712 +#define REG_NOTIFY_CHANGE_NAME 0x00000001L
713 +#define REG_NOTIFY_CHANGE_ATTRIBUTES 0x00000002L
714 +#define REG_NOTIFY_CHANGE_LAST_SET 0x00000004L
715 +#define REG_NOTIFY_CHANGE_SECURITY 0x00000008L
716 +#define REG_LEGAL_CHANGE_FILTER \
717 + (REG_NOTIFY_CHANGE_NAME |\
718 + REG_NOTIFY_CHANGE_ATTRIBUTES |\
719 + REG_NOTIFY_CHANGE_LAST_SET |\
720 + REG_NOTIFY_CHANGE_SECURITY)
722 +#endif
724 static BOOL PyHKEY_AsHKEY(PyObject *ob, HKEY *pRes, BOOL bNoneOK);
725 static PyObject *PyHKEY_FromHKEY(HKEY h);
726 diff --git a/PC/import_nt.c b/PC/import_nt.c
727 index 196a774..ef1efe8 100644
728 --- a/PC/import_nt.c
729 +++ b/PC/import_nt.c
730 @@ -9,7 +9,7 @@
731 #include "Python.h"
732 #include "osdefs.h"
733 #include <windows.h>
734 -#include "importdl.h"
735 +#include "../Python/importdl.h"
736 #include "malloc.h" /* for alloca */
738 /* a string loaded from the DLL at startup */
739 diff --git a/Python/dynload_win.c b/Python/dynload_win.c
740 index 4e5555e..220119c 100644
741 --- a/Python/dynload_win.c
742 +++ b/Python/dynload_win.c
743 @@ -28,7 +28,7 @@ const struct filedescr _PyImport_DynLoadFiletab[] = {
744 /* Case insensitive string compare, to avoid any dependencies on particular
745 C RTL implementations */
747 -static int strcasecmp (char *string1, char *string2)
748 +static int py_strcasecmp (char *string1, char *string2)
750 int first, second;
752 @@ -41,6 +41,7 @@ static int strcasecmp (char *string1, char *string2)
754 return (first - second);
756 +#define strcasecmp py_strcasecmp
759 /* Function to return the name of the "python" DLL that the supplied module
760 diff --git a/Python/random.c b/Python/random.c
761 index a2ae002..9d046d0 100644
762 --- a/Python/random.c
763 +++ b/Python/random.c
764 @@ -12,6 +12,13 @@ static int _Py_HashSecret_Initialized = 0;
765 #endif
767 #ifdef MS_WINDOWS
769 +#ifndef PROV_RSA_FULL
770 +typedef ULONG_PTR HCRYPTPROV;
771 +#define PROV_RSA_FULL 1
772 +#define CRYPT_VERIFYCONTEXT 0xF0000000
773 +#endif
775 typedef BOOL (WINAPI *CRYPTACQUIRECONTEXTA)(HCRYPTPROV *phProv,\
776 LPCSTR pszContainer, LPCSTR pszProvider, DWORD dwProvType,\
777 DWORD dwFlags );
778 diff --git a/configure b/configure
779 index 3948080..1675812 100644
780 --- a/configure
781 +++ b/configure
782 @@ -11129,12 +11129,12 @@ _ACEOF
784 $as_echo "#define HAVE_ST_BLOCKS 1" >>confdefs.h
786 -else
787 - case " $LIBOBJS " in
788 - *" fileblocks.$ac_objext "* ) ;;
789 - *) LIBOBJS="$LIBOBJS fileblocks.$ac_objext"
790 - ;;
791 -esac
792 +#else
793 +# case " $LIBOBJS " in
794 +# *" fileblocks.$ac_objext "* ) ;;
795 +# *) LIBOBJS="$LIBOBJS fileblocks.$ac_objext"
796 +# ;;
797 +#esac
802 1.7.11.msysgit.1.1.gf0affa1