0530-msys-mingw-prefer-unix-sep-if-MSYSTEM.patch
0535-msys-cygwin-semi-native-build-sysconfig.patch
Add a bug-fix from Arch Linux mingw-w64-python 2.7.6
for a memory stomp.
Fix python{3.3m}-config.sh to return correct values.
Tidy up the PKGBUILD files.
209 lines
5.8 KiB
Diff
209 lines
5.8 KiB
Diff
diff -urN a/Modules/getpath.c b/Modules/getpath.c
|
|
--- a/Modules/getpath.c 2014-01-22 20:57:24.012180163 +0000
|
|
+++ b/Modules/getpath.c 2014-01-22 20:57:24.542188432 +0000
|
|
@@ -10,6 +10,10 @@
|
|
#include <mach-o/dyld.h>
|
|
#endif
|
|
|
|
+#ifdef MS_WINDOWS
|
|
+#include <windows.h>
|
|
+#endif
|
|
+
|
|
/* Search in some common locations for the associated Python libraries.
|
|
*
|
|
* Two directories must be found, the platform independent directory
|
|
@@ -128,6 +132,10 @@
|
|
static char prefix[MAXPATHLEN+1];
|
|
static char exec_prefix[MAXPATHLEN+1];
|
|
static char progpath[MAXPATHLEN+1];
|
|
+#ifdef MS_WINDOWS
|
|
+static char dllpath[MAXPATHLEN+1];
|
|
+extern HANDLE PyWin_DLLhModule;
|
|
+#endif
|
|
static char *module_search_path = NULL;
|
|
static char lib_python[] = "lib/python" VERSION;
|
|
|
|
@@ -208,7 +216,11 @@
|
|
joinpath(char *buffer, char *stuff)
|
|
{
|
|
size_t n, k;
|
|
+#ifdef MS_WINDOWS
|
|
+ if (stuff[0] == SEP || (stuff[0] != 0 && stuff[1] == ':'))
|
|
+#else
|
|
if (stuff[0] == SEP)
|
|
+#endif
|
|
n = 0;
|
|
else {
|
|
n = strlen(buffer);
|
|
@@ -229,7 +241,11 @@
|
|
static void
|
|
copy_absolute(char *path, char *p)
|
|
{
|
|
+#ifdef MS_WINDOWS
|
|
+ if (p[0] == SEP || (p[0] != 0 && p[1] == ':'))
|
|
+#else
|
|
if (p[0] == SEP)
|
|
+#endif
|
|
strcpy(path, p);
|
|
else {
|
|
if (!getcwd(path, MAXPATHLEN)) {
|
|
@@ -249,7 +265,11 @@
|
|
{
|
|
char buffer[MAXPATHLEN + 1];
|
|
|
|
+#ifdef MS_WINDOWS
|
|
+ if (path[0] == SEP || (path[0] != 0 && path[1] == ':'))
|
|
+#else
|
|
if (path[0] == SEP)
|
|
+#endif
|
|
return;
|
|
copy_absolute(buffer, path);
|
|
strcpy(path, buffer);
|
|
@@ -382,6 +402,35 @@
|
|
}
|
|
|
|
|
|
+#ifdef MS_WINDOWS
|
|
+/* Calculates dllpath and progpath, replacing \\ with / */
|
|
+int GetWindowsModulePaths()
|
|
+{
|
|
+ int result = 0;
|
|
+ char* seps;
|
|
+ result = GetModuleFileNameA(NULL, progpath, MAXPATHLEN);
|
|
+ seps = strchr(progpath, '\\');
|
|
+ while(seps) {
|
|
+ *seps = '/';
|
|
+ seps = strchr(seps, '\\');
|
|
+ }
|
|
+ dllpath[0] = '\0';
|
|
+#ifdef Py_ENABLE_SHARED
|
|
+ if (PyWin_DLLhModule) {
|
|
+ if((GetModuleFileNameA(PyWin_DLLhModule, dllpath, MAXPATHLEN) > 0)) {
|
|
+ result = 1;
|
|
+ seps = strchr(dllpath, '\\');
|
|
+ while(seps) {
|
|
+ *seps = '/';
|
|
+ seps = strchr(seps, '\\');
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+#endif
|
|
+ return result;
|
|
+}
|
|
+#endif /* MS_WINDOWS */
|
|
+
|
|
static void
|
|
calculate_path(void)
|
|
{
|
|
@@ -433,6 +482,10 @@
|
|
else if(0 == _NSGetExecutablePath(progpath, &nsexeclength) && progpath[0] == SEP)
|
|
;
|
|
#endif /* __APPLE__ */
|
|
+#ifdef MS_WINDOWS
|
|
+ else if(GetWindowsModulePaths()) {
|
|
+ }
|
|
+#endif /* MS_WINDOWS */
|
|
else if (path) {
|
|
while (1) {
|
|
char *delim = strchr(path, DELIM);
|
|
@@ -460,7 +513,11 @@
|
|
}
|
|
else
|
|
progpath[0] = '\0';
|
|
+#ifdef MS_WINDOWS
|
|
+ if (progpath[0] != '\0' && progpath[0] != SEP && progpath[1] != ':')
|
|
+#else
|
|
if (progpath[0] != SEP && progpath[0] != '\0')
|
|
+#endif
|
|
absolutize(progpath);
|
|
strncpy(argv0_path, progpath, MAXPATHLEN);
|
|
argv0_path[MAXPATHLEN] = '\0';
|
|
diff -urN a/Modules/posixmodule.c b/Modules/posixmodule.c
|
|
--- a/Modules/posixmodule.c 2014-01-22 20:57:24.035513932 +0000
|
|
+++ b/Modules/posixmodule.c 2014-01-22 20:57:24.542188432 +0000
|
|
@@ -2322,7 +2322,7 @@
|
|
Py_END_ALLOW_THREADS
|
|
/* FindNextFile sets error to ERROR_NO_MORE_FILES if
|
|
it got to the end of the directory. */
|
|
- if (!result && GetLastError() != ERROR_NO_MORE_FILES) {
|
|
+ if (!result && GetLastError() != 0 && GetLastError() != ERROR_NO_MORE_FILES) {
|
|
Py_DECREF(d);
|
|
win32_error_unicode("FindNextFileW", wnamebuf);
|
|
FindClose(hFindFile);
|
|
@@ -2390,7 +2390,7 @@
|
|
Py_END_ALLOW_THREADS
|
|
/* FindNextFile sets error to ERROR_NO_MORE_FILES if
|
|
it got to the end of the directory. */
|
|
- if (!result && GetLastError() != ERROR_NO_MORE_FILES) {
|
|
+ if (!result && GetLastError() != 0 && GetLastError() != ERROR_NO_MORE_FILES) {
|
|
Py_DECREF(d);
|
|
win32_error("FindNextFile", namebuf);
|
|
FindClose(hFindFile);
|
|
diff -urN a/Parser/metagrammar.c b/Parser/metagrammar.c
|
|
--- a/Parser/metagrammar.c 2014-01-22 20:57:24.008846800 +0000
|
|
+++ b/Parser/metagrammar.c 2014-01-22 20:57:24.542188432 +0000
|
|
@@ -139,7 +139,7 @@
|
|
{7, 0},
|
|
{8, 0},
|
|
};
|
|
-static grammar _PyParser_Grammar = {
|
|
+static grammar _PyParser_MetaGrammar = {
|
|
6,
|
|
dfas,
|
|
{19, labels},
|
|
@@ -149,7 +149,7 @@
|
|
grammar *
|
|
meta_grammar(void)
|
|
{
|
|
- return &_PyParser_Grammar;
|
|
+ return &_PyParser_MetaGrammar;
|
|
}
|
|
|
|
grammar *
|
|
diff -urN a/Python/pythonrun.c b/Python/pythonrun.c
|
|
--- a/Python/pythonrun.c 2014-01-22 20:57:24.158849157 +0000
|
|
+++ b/Python/pythonrun.c 2014-01-22 20:57:24.542188432 +0000
|
|
@@ -18,6 +18,7 @@
|
|
#include "eval.h"
|
|
#include "marshal.h"
|
|
#include "abstract.h"
|
|
+#include "osdefs.h"
|
|
|
|
#ifdef HAVE_SIGNAL_H
|
|
#include <signal.h>
|
|
@@ -671,6 +672,13 @@
|
|
void
|
|
Py_SetProgramName(char *pn)
|
|
{
|
|
+#ifdef __MINGW32__
|
|
+ char* seps = strchr(pn, ALTSEP);
|
|
+ while(seps) {
|
|
+ *seps = SEP;
|
|
+ seps = strchr(seps, ALTSEP);
|
|
+ }
|
|
+#endif
|
|
if (pn && *pn)
|
|
progname = pn;
|
|
}
|
|
diff -urN a/configure.ac b/configure.ac
|
|
--- a/configure.ac 2014-01-22 20:57:24.012180163 +0000
|
|
+++ b/configure.ac 2014-01-22 20:57:24.538855019 +0000
|
|
@@ -3068,7 +3068,7 @@
|
|
AC_MSG_CHECKING(MACHDEP_OBJS)
|
|
case $host in
|
|
*-*-mingw*)
|
|
- extra_machdep_objs="PC/dl_nt.o PC/getpathp.o PC/import_nt.o"
|
|
+ extra_machdep_objs="PC/dl_nt.o Modules/getpath.o PC/import_nt.o"
|
|
;;
|
|
esac
|
|
if test -z "$MACHDEP_OBJS"
|
|
@@ -4823,7 +4823,7 @@
|
|
# FIXME: why windows builds don't use PC/frozen_dllmain.o ?
|
|
PYTHON_OBJS_FROZENMAIN=""
|
|
# default sys.path calculations for windows platforms
|
|
- MODULE_GETPATH=PC/getpathp.o
|
|
+ MODULE_GETPATH=Modules/getpath.o
|
|
;;
|
|
esac
|
|
|