GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing bugs.python.org — bugs.python.org diff -r b0668185dc15 Modules/getpath.c
--- a/Modules/getpath.c Tue Jun 25 23:13:47 2013 +0200
+++ b/Modules/getpath.c Thu Jul 04 09:27:47 2013 +0200
@@ -363,6 +363,21 @@
reduce(prefix);
} while (prefix[0]);
+ /* search relative to the python shared library */
+ if (_PyImport_GetSharedLibPath(prefix, MAXPATHLEN)) {
+ /* make this work on *nix and win32 ../lib/python3 */
+ reduce(prefix);
+ reduce(prefix);
+ if (wcslen(prefix) + 1 + wcslen(lib_python) < MAXPATHLEN) {
+ joinpath(prefix, lib_python);
+ if (wcslen(prefix) + 1 + wcslen(LANDMARK) < MAXPATHLEN) {
+ joinpath(prefix, LANDMARK);
+ if (ismodule(prefix))
+ return 1;
+ }
+ }
+ }
+
/* Look at configure's PREFIX */
wcsncpy(prefix, _prefix, MAXPATHLEN);
joinpath(prefix, lib_python);
@@ -440,6 +455,21 @@
reduce(exec_prefix);
} while (exec_prefix[0]);
+ /* search relative to the python shared library */
+ if (_PyImport_GetSharedLibPath(exec_prefix, MAXPATHLEN)) {
+ /* make this work on *nix and win32 ../lib/python3/lib-dynload */
+ reduce(exec_prefix);
+ reduce(exec_prefix);
+ if (wcslen(exec_prefix) + 1 + wcslen(lib_python) < MAXPATHLEN) {
+ joinpath(exec_prefix, lib_python);
+ if (wcslen(exec_prefix) + 12 < MAXPATHLEN) {
+ joinpath(exec_prefix, L"lib-dynload");
+ if (isdir(exec_prefix))
+ return 1;
+ }
+ }
+ }
+
/* Look at configure's EXEC_PREFIX */
wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN);
joinpath(exec_prefix, lib_python);
diff -r b0668185dc15 Python/dynload_aix.c
--- a/Python/dynload_aix.c Tue Jun 25 23:13:47 2013 +0200
+++ b/Python/dynload_aix.c Thu Jul 04 09:27:47 2013 +0200
@@ -181,3 +181,9 @@
return p;
}
+
+int
+_PyImport_GetSharedLibPath(const wchar_t *path, size_t len)
+{
+ return 0;
+}
diff -r b0668185dc15 Python/dynload_dl.c
--- a/Python/dynload_dl.c Tue Jun 25 23:13:47 2013 +0200
+++ b/Python/dynload_dl.c Thu Jul 04 09:27:47 2013 +0200
@@ -20,3 +20,10 @@
PyOS_snprintf(funcname, sizeof(funcname), "PyInit_%.200s", shortname);
return dl_loadmod(Py_GetProgramName(), pathname, funcname);
}
+
+int
+_PyImport_GetSharedLibPath(const wchar_t *path, size_t len)
+{
+ return 0;
+}
+
diff -r b0668185dc15 Python/dynload_hpux.c
--- a/Python/dynload_hpux.c Tue Jun 25 23:13:47 2013 +0200
+++ b/Python/dynload_hpux.c Thu Jul 04 09:27:47 2013 +0200
@@ -62,3 +62,10 @@
return p;
}
+
+int
+_PyImport_GetSharedLibPath(const wchar_t *path, size_t len)
+{
+ return 0;
+}
+
diff -r b0668185dc15 Python/dynload_next.c
--- a/Python/dynload_next.c Tue Jun 25 23:13:47 2013 +0200
+++ b/Python/dynload_next.c Thu Jul 04 09:27:47 2013 +0200
@@ -108,3 +108,10 @@
p = (dl_funcptr)NSAddressOfSymbol(theSym);
return p;
}
+
+int
+_PyImport_GetSharedLibPath(const wchar_t *path, size_t len)
+{
+ return 0;
+}
+
diff -r b0668185dc15 Python/dynload_shlib.c
--- a/Python/dynload_shlib.c Tue Jun 25 23:13:47 2013 +0200
+++ b/Python/dynload_shlib.c Thu Jul 04 09:27:47 2013 +0200
@@ -149,3 +149,20 @@
p = (dl_funcptr) dlsym(handle, funcname);
return p;
}
+
+int
+_PyImport_GetSharedLibPath(const wchar_t *path, size_t len)
+{
+ Dl_info info;
+ wchar_t* buffer;
+ if (0 == dladdr((void*)_PyImport_GetSharedLibPath, &info))
+ return 0;
+ if (!info.dli_fname)
+ return 0;
+ buffer = _Py_char2wchar(info.dli_fname, NULL);
+ if (!buffer)
+ return 0;
+ wcsncpy(path, buffer, len);
+ PyMem_Free(buffer);
+ return 1;
+}
diff -r b0668185dc15 Python/dynload_win.c
--- a/Python/dynload_win.c Tue Jun 25 23:13:47 2013 +0200
+++ b/Python/dynload_win.c Thu Jul 04 09:27:47 2013 +0200
@@ -295,3 +295,22 @@
return p;
}
+
+int
+_PyImport_GetSharedLibPath(const wchar_t *path, size_t len)
+{
+ HMODULE handle;
+ DWORD flags;
+
+ flags = GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
+ | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS;
+
+ if (!GetModuleHandleExW(flags, (LPCWSTR)_PyImport_GetSharedLibPath, &handle))
+ return 0;
+
+ DWORD retval = GetModuleFileNameW(handle, path, len);
+ if (retval == 0 || len <= retval)
+ return 0;
+
+ return 1;
+}
|
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |