summaryrefslogtreecommitdiffstats
path: root/PC/os2vacpp/getpathp.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-12-05 22:07:14 (GMT)
committerGuido van Rossum <guido@python.org>1997-12-05 22:07:14 (GMT)
commita34c31352b0d29177fb537c4cc37eb46e41f9359 (patch)
tree1a34126215a689460560d995e2a61a368df99e67 /PC/os2vacpp/getpathp.c
parentcee1dca4e7b870e0fc1a712b5a2691552b104475 (diff)
downloadcpython-a34c31352b0d29177fb537c4cc37eb46e41f9359.zip
cpython-a34c31352b0d29177fb537c4cc37eb46e41f9359.tar.gz
cpython-a34c31352b0d29177fb537c4cc37eb46e41f9359.tar.bz2
New batch of patches by Jeff Rush; moved his readme.txt portion here.
Diffstat (limited to 'PC/os2vacpp/getpathp.c')
-rw-r--r--PC/os2vacpp/getpathp.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/PC/os2vacpp/getpathp.c b/PC/os2vacpp/getpathp.c
index 2cfba16..69e38cb 100644
--- a/PC/os2vacpp/getpathp.c
+++ b/PC/os2vacpp/getpathp.c
@@ -50,7 +50,11 @@ extern BOOL PyWin_IsWin32s();
/* Search in some common locations for the associated Python libraries.
*
- * This version always returns "" for both prefix and exec_prefix.
+ * Two directories must be found, the platform independent directory
+ * (prefix), containing the common .py and .pyc files, and the platform
+ * dependent directory (exec_prefix), containing the shared library
+ * modules. Note that prefix and exec_prefix can be the same directory,
+ * but for some installations, they are different.
*
* Py_GetPath() tries to return a sensible Python module search path.
*
@@ -75,6 +79,7 @@ extern BOOL PyWin_IsWin32s();
#endif
static char prefix[MAXPATHLEN+1];
+static char exec_prefix[MAXPATHLEN+1];
static char progpath[MAXPATHLEN+1];
static char *module_search_path = NULL;
@@ -345,9 +350,21 @@ calculate_path()
else
pythonhome = NULL;
}
- else
+ else {
+ char *delim;
+
strcpy(prefix, pythonhome);
+ /* Extract Any Optional Trailing EXEC_PREFIX */
+ /* e.g. PYTHONHOME=<prefix>:<exec_prefix> */
+ delim = strchr(prefix, DELIM);
+ if (delim) {
+ *delim = '\0';
+ strcpy(exec_prefix, delim+1);
+ } else
+ strcpy(exec_prefix, EXEC_PREFIX);
+ }
+
if (envpath && *envpath == '\0')
envpath = NULL;
@@ -475,7 +492,10 @@ Py_GetPrefix()
char *
Py_GetExecPrefix()
{
- return Py_GetPrefix();
+ if (!module_search_path)
+ calculate_path();
+
+ return exec_prefix;
}
char *