summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2009-02-02 14:23:16 +0000
committerMartin v. Löwis <martin@v.loewis.de>2009-02-02 14:23:16 +0000
commitf25cec25c727268150df8c00faa6464ce1b93e81 (patch)
treecd15431776a35995c3757c5d0cb7183be46b82c5
parent45c46d34b5d681ad0dd137a485d1dc7ac0f5af86 (diff)
downloadcpython-f25cec25c727268150df8c00faa6464ce1b93e81.tar.gz
Issue #4494: Fix build with Py_NO_ENABLE_SHARED on Windows.
-rw-r--r--Misc/NEWS2
-rw-r--r--PC/getpathp.c12
2 files changed, 14 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index c403b61ae4..454ad41779 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -397,6 +397,8 @@ Tools/Demos
Build
-----
+- Issue #4494: Fix build with Py_NO_ENABLE_SHARED on Windows.
+
- Issue #4895: Use _strdup on Windows CE.
- Issue #4472: "configure --enable-shared" now works on OSX
diff --git a/PC/getpathp.c b/PC/getpathp.c
index e62b936f2d..78f446599a 100644
--- a/PC/getpathp.c
+++ b/PC/getpathp.c
@@ -201,6 +201,7 @@ search_for_prefix(char *argv0_path, char *landmark)
}
#ifdef MS_WINDOWS
+#ifdef Py_ENABLE_SHARED
/* a string loaded from the DLL at startup.*/
extern const char *PyWin_DLLVersionString;
@@ -363,6 +364,7 @@ done:
free(keyBuf);
return retval;
}
+#endif /* Py_ENABLE_SHARED */
#endif /* MS_WINDOWS */
static void
@@ -380,6 +382,7 @@ get_progpath(void)
but makes no mention of the null terminator. Play it safe.
PLUS Windows itself defines MAX_PATH as the same, but anyway...
*/
+#ifdef Py_ENABLE_SHARED
wprogpath[MAXPATHLEN]=_T('\0');
if (PyWin_DLLhModule &&
GetModuleFileName(PyWin_DLLhModule, wprogpath, MAXPATHLEN)) {
@@ -388,6 +391,9 @@ get_progpath(void)
dllpath, MAXPATHLEN+1,
NULL, NULL);
}
+#else
+ dllpath[0] = 0;
+#endif
wprogpath[MAXPATHLEN]=_T('\0');
if (GetModuleFileName(NULL, wprogpath, MAXPATHLEN)) {
WideCharToMultiByte(CP_ACP, 0,
@@ -398,9 +404,13 @@ get_progpath(void)
}
#else
/* static init of progpath ensures final char remains \0 */
+#ifdef Py_ENABLE_SHARED
if (PyWin_DLLhModule)
if (!GetModuleFileName(PyWin_DLLhModule, dllpath, MAXPATHLEN))
dllpath[0] = 0;
+#else
+ dllpath[0] = 0;
+#endif
if (GetModuleFileName(NULL, progpath, MAXPATHLEN))
return;
#endif
@@ -501,8 +511,10 @@ calculate_path(void)
}
skiphome = pythonhome==NULL ? 0 : 1;
+#ifdef Py_ENABLE_SHARED
machinepath = getpythonregpath(HKEY_LOCAL_MACHINE, skiphome);
userpath = getpythonregpath(HKEY_CURRENT_USER, skiphome);
+#endif
/* We only use the default relative PYTHONPATH if we havent
anything better to use! */
skipdefault = envpath!=NULL || pythonhome!=NULL || \