Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit da80f9b

Browse files
jcfrdavidsansome
andcommitted
MinGW support: Add patches-win32/03-mingw32.patch
This commit integrates changes originally added to the project as python-cmake-buildsystem/python-cmake-buildsystem@18de7ac65 (Fix the nt module) and python-cmake-buildsystem/python-cmake-buildsystem@a2606f959 (config-mingw: Add (i686|x86_64)-w64-mingw32 toolchain support from MXE) Co-authored-by: David Sansome <[email protected]>
1 parent 267711f commit da80f9b

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

Modules/posixmodule.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,20 @@ corresponding Unix manual entries for more information on calls.");
134134
#else
135135
#if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS)
136136
/* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */
137-
#else /* all other compilers */
137+
#else
138+
#if defined(__MINGW32__)
139+
#define HAVE_EXECV 1
140+
#if defined(__USLC__) && defined(__SCO_VERSION__) /* SCO UDK Compiler */
141+
#define HAVE_FORK1 1
142+
#endif
143+
#define HAVE_GETCWD 1
144+
#define HAVE_OPENDIR 1
145+
#define HAVE_PIPE 1
146+
#ifndef __rtems__
147+
#define HAVE_POPEN 1
148+
#endif
149+
#define HAVE_SYSTEM 1
150+
#else /* all other compilers */
138151
/* Unix functions that the configure script doesn't check for */
139152
#define HAVE_EXECV 1
140153
#define HAVE_FORK 1
@@ -156,13 +169,14 @@ corresponding Unix manual entries for more information on calls.");
156169
#define HAVE_SYSTEM 1
157170
#define HAVE_WAIT 1
158171
#define HAVE_TTYNAME 1
172+
#endif /* __MINGW32__ */
159173
#endif /* PYOS_OS2 && PYCC_GCC && __VMS */
160174
#endif /* _MSC_VER */
161175
#endif /* __BORLANDC__ */
162176
#endif /* ! __WATCOMC__ || __QNX__ */
163177
#endif /* ! __IBMC__ */
164178

165-
#ifndef _MSC_VER
179+
#if !defined(_MSC_VER) && !defined(__MINGW32__)
166180

167181
#if defined(__sgi)&&_COMPILER_VERSION>=700
168182
/* declare ctermid_r if compiling with MIPSPro 7.x in ANSI C mode
@@ -214,7 +228,7 @@ extern int lstat(const char *, struct stat *);
214228
#endif /* HAVE_LSTAT */
215229
#endif /* !HAVE_UNISTD_H */
216230

217-
#endif /* !_MSC_VER */
231+
#endif /* !_MSC_VER && !__MINGW32__ */
218232

219233
#ifdef HAVE_UTIME_H
220234
#include <utime.h>
@@ -259,7 +273,7 @@ extern int lstat(const char *, struct stat *);
259273
#endif
260274
#endif
261275

262-
#ifdef _MSC_VER
276+
#if defined(_MSC_VER) || defined(__MINGW32__)
263277
#ifdef HAVE_DIRECT_H
264278
#include <direct.h>
265279
#endif
@@ -276,7 +290,7 @@ extern int lstat(const char *, struct stat *);
276290
#include <shellapi.h> /* for ShellExecute() */
277291
#define popen _popen
278292
#define pclose _pclose
279-
#endif /* _MSC_VER */
293+
#endif /* _MSC_VER || __MINGW32__ */
280294

281295
#if defined(PYCC_VACPP) && defined(PYOS_OS2)
282296
#include <io.h>
@@ -1590,7 +1604,7 @@ _pystat_fromstructstat(STRUCT_STAT *st)
15901604
return v;
15911605
}
15921606

1593-
#ifdef MS_WINDOWS
1607+
#if defined(MS_WINDOWS) && !defined(__MINGW32__)
15941608

15951609
/* IsUNCRoot -- test whether the supplied path is of the form \\SERVER\SHARE\,
15961610
where / can be used in place of \ and the trailing slash is optional.
@@ -9452,7 +9466,7 @@ all_ins(PyObject *d)
94529466
}
94539467

94549468

9455-
#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__)
9469+
#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) && !defined(__QNX__)
94569470
#define INITFUNC initnt
94579471
#define MODNAME "nt"
94589472

0 commit comments

Comments
 (0)