Merge.
[fedora-mingw.git] / python3 / mingw32-python-3.1-posixmodule.patch
1 Index: Modules/posixmodule.c
2 ===================================================================
3 --- Modules/posixmodule.c       (revision 67686)
4 +++ Modules/posixmodule.c       (working copy)
5 @@ -98,6 +98,7 @@
6  
7  /* Various compilers have only certain posix functions */
8  /* XXX Gosh I wish these were all moved into pyconfig.h */
9 +/* XXX RWMJ agrees.  This sucks for cross-compiling. */
10  #if defined(PYCC_VACPP) && defined(PYOS_OS2)
11  #include <process.h>
12  #else
13 @@ -129,6 +130,15 @@
14  #define HAVE_FSYNC     1
15  #define fsync _commit
16  #else
17 +#if defined(__MINGW32__)       /* MinGW, similar to MS compiler. */
18 +#define HAVE_GETCWD     1
19 +#define HAVE_SPAWNV    1
20 +#define HAVE_EXECV      1
21 +#define HAVE_SYSTEM    1
22 +#define HAVE_CWAIT     1
23 +#define HAVE_FSYNC     1
24 +#define fsync _commit
25 +#else
26  #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS)
27  /* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */
28  #else                  /* all other compilers */
29 @@ -151,6 +161,7 @@
30  #define HAVE_WAIT       1
31  #define HAVE_TTYNAME   1
32  #endif  /* PYOS_OS2 && PYCC_GCC && __VMS */
33 +#endif  /* __MINGW32__ */
34  #endif  /* _MSC_VER */
35  #endif  /* __BORLANDC__ */
36  #endif  /* ! __WATCOMC__ || __QNX__ */
37 @@ -168,7 +179,7 @@
38  #if defined(PYCC_VACPP)
39  extern int mkdir(char *);
40  #else
41 -#if ( defined(__WATCOMC__) || defined(_MSC_VER) ) && !defined(__QNX__)
42 +#if ( defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) ) && !defined(__QNX__)
43  extern int mkdir(const char *);
44  #else
45  extern int mkdir(const char *, mode_t);
46 @@ -2488,7 +2499,7 @@
47                               Py_FileSystemDefaultEncoding, &path, &mode))
48                 return NULL;
49         Py_BEGIN_ALLOW_THREADS
50 -#if ( defined(__WATCOMC__) || defined(PYCC_VACPP) ) && !defined(__QNX__)
51 +#if ( defined(__WATCOMC__) || defined(PYCC_VACPP) || defined(__MINGW32__)) && !defined(__QNX__)
52         res = mkdir(path);
53  #else
54         res = mkdir(path, mode);