Files
MINGW-packages/mingw-w64-python2/0515-mingw-add-GetModuleFileName-path-to-PATH.patch
Ray Donnelly d81e579c18 python 2(+3): patches for dirsep as / and sysconfig
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.
2014-01-29 02:08:31 +00:00

46 lines
1.5 KiB
Diff

diff -urN a/Modules/getpath.c b/Modules/getpath.c
--- a/Modules/getpath.c 2014-01-22 20:57:43.262477913 +0000
+++ b/Modules/getpath.c 2014-01-22 20:57:43.752485492 +0000
@@ -131,9 +131,9 @@
static char prefix[MAXPATHLEN+1];
static char exec_prefix[MAXPATHLEN+1];
-static char progpath[MAXPATHLEN+1];
+static char progpath[MAXPATHLEN+1] = {'\0'};
#ifdef MS_WINDOWS
-static char dllpath[MAXPATHLEN+1];
+static char dllpath[MAXPATHLEN+1] = {'\0'};
extern HANDLE PyWin_DLLhModule;
#endif
static char *module_search_path = NULL;
@@ -726,6 +726,29 @@
}
else
strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN);
+#ifdef MS_WINDOWS
+ if (module_search_path) {
+ /* Add path of executable/dll to system path. This
+ * is so that the correct tcl??.dll and tk??.dll get
+ * used. */
+ char *module_path = dllpath[0] ? dllpath : progpath;
+ char *new_path = alloca(strlen("PATH=")+strlen(module_path)+1+strlen(dllpath)+1);
+ if (new_path) {
+ strcpy( new_path, "PATH=" );
+ strcat( new_path, module_path );
+ char *slashes = strchr( new_path, '/' );
+ while (slashes) {
+ *slashes = '\\';
+ slashes = strchr( slashes+1, '/' );
+ }
+ char *end = strrchr(new_path, '\\') ? strrchr(new_path, '\\') : new_path + strlen(new_path);
+ end[0] = ';';
+ end[1] = '\0';
+ strcat( new_path, path );
+ _putenv( new_path );
+ }
+ }
+#endif
}