Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(9)

Unified Diff: Modules/posixmodule.c

Issue 3871: cross and native build of python for mingw32 with distutils
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Modules/_multiprocessing/multiprocessing.c ('k') | Modules/python.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Modules/posixmodule.c Thu Dec 27 23:52:36 2012 +0200
+++ b/Modules/posixmodule.c Thu Dec 27 17:35:12 2012 -0500
@@ -175,6 +175,23 @@
#define HAVE_CWAIT 1
#define HAVE_FSYNC 1
#define fsync _commit
+#elif defined(__MINGW32__) /* GCC (mingw special) compiler */
+/*#define HAVE_GETCWD 1 - detected by configure*/
+#define HAVE_SPAWNV 1
+#define HAVE_EXECV 1
+#define HAVE_PIPE 1
+#define HAVE_POPEN 1
+#define HAVE_SYSTEM 1
+#define HAVE_CWAIT 1
+#define HAVE_FSYNC 1
+#undef HAVE_FTRUNCATE /* mingw implement it as _chsize. undef to be compatible */
+#undef HAVE_TRUNCATE /* mingw-w64 implement it. undef to be compatible */
+#define fsync _commit
+#include <windows.h>
+#include <winioctl.h>
+#ifndef _MAX_ENV
+#define _MAX_ENV 32767
+#endif
#else
#if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS)
/* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */
@@ -302,7 +319,7 @@
#endif
#endif
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
#ifdef HAVE_DIRECT_H
#include <direct.h>
#endif
@@ -894,6 +911,15 @@
http://msdn.microsoft.com/en-us/library/ms791514.aspx as the required
include doesn't seem to be present in the Windows SDK (at least as included
with Visual Studio Express). */
+#ifndef HAVE_REPARSE_DATA_BUFFER
+/*
+ * REPARSE_DATA_BUFFER is defined in <winnt.h> on mingw.org w32api
+ * instead as is documented in <ntifs.h>. The mingw-w64 API define
+ * it in <ddk/ntifs.h> but we can not include as header like
+ * <ntddk.h> is required instead <ddk/ntddk.h>, i.e. to use mingw-w64
+ * headers user must specify explicitly path to ddk :(.
+ * So lest check at configure time and use MSC hack if not found.
+ */
typedef struct _REPARSE_DATA_BUFFER {
ULONG ReparseTag;
USHORT ReparseDataLength;
@@ -924,7 +950,10 @@
#define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER,\
GenericReparseBuffer)
+#ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE
#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 )
+#endif
+#endif /*ndef HAVE_REPARSE_DATA_BUFFER*/
static int
win32_get_reparse_tag(HANDLE reparse_point_handle, ULONG *reparse_tag)
@@ -957,7 +986,7 @@
*/
#include <crt_externs.h>
static char **environ;
-#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
+#elif !defined(_MSC_VER) && !defined(__MINGW32__) && ( !defined(__WATCOMC__) || defined(__QNX__) )
extern char **environ;
#endif /* !_MSC_VER */
@@ -1278,7 +1307,7 @@
static PyObject*
win32_1str(PyObject* args, char* func,
char* format, BOOL (__stdcall *funcA)(LPCSTR),
- char* wformat, BOOL (__stdcall *funcW)(LPWSTR))
+ char* wformat, BOOL (__stdcall *funcW)(LPCWSTR))
{
PyObject *uni;
const char *ansi;
@@ -1405,7 +1434,7 @@
int st_ctime_nsec;
};
-static __int64 secs_between_epochs = 11644473600; /* Seconds between 1.1.1601 and 1.1.1970 */
+static __int64 secs_between_epochs = Py_LL(11644473600); /* Seconds between 1.1.1601 and 1.1.1970 */
static void
FILE_TIME_to_time_t_nsec(FILETIME *in_ptr, time_t *time_out, int* nsec_out)
@@ -3704,7 +3733,6 @@
} /* end of posix__getfullpathname */
-
/* A helper function for samepath on windows */
static PyObject *
posix__getfinalpathname(PyObject *self, PyObject *args)
@@ -11637,7 +11665,7 @@
}
-#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__)
+#if (defined(_MSC_VER) || defined (__MINGW32__) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__)
#define INITFUNC PyInit_nt
#define MODNAME "nt"
« no previous file with comments | « Modules/_multiprocessing/multiprocessing.c ('k') | Modules/python.c » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+