Commit aba156df authored by Jack Jansen's avatar Jack Jansen

With WITH_NEXT_FRAMEWORK defined we now also expect a normal Python

installation.
If there is no LANDMARK we assume we're a bare framework in the
install directory (again WITH_NEXT_FRAMEWORK only).
parent 059ba6b6
/* Return the initial module search path. */ /* Return the initial module search path. */
#include "Python.h" #include "Python.h"
...@@ -371,16 +370,31 @@ calculate_path(void) ...@@ -371,16 +370,31 @@ calculate_path(void)
#endif #endif
#ifdef WITH_NEXT_FRAMEWORK #ifdef WITH_NEXT_FRAMEWORK
/* XXX Need to check this code for buffer overflows */
pythonModule = NSModuleForSymbol(NSLookupAndBindSymbol("_Py_Initialize")); pythonModule = NSModuleForSymbol(NSLookupAndBindSymbol("_Py_Initialize"));
/* Use dylib functions to find out where the framework was loaded from */ /* Use dylib functions to find out where the framework was loaded from */
buf = NSLibraryNameForModule(pythonModule); buf = NSLibraryNameForModule(pythonModule);
if (buf != NULL) { if (buf != NULL) {
/* We're in a framework. */ /* We're in a framework. */
strcpy(progpath, buf); /* See if we might be in the build directory. The framework in the
** build directory is incomplete, it only has the .dylib and a few
/* Frameworks have support for versioning */ ** needed symlinks, it doesn't have the Lib directories and such.
strcpy(lib_python, "lib"); ** If we're running with the framework from the build directory we must
** be running the interpreter in the build directory, so we use the
** build-directory-specific logic to find Lib and such.
*/
strncpy(argv0_path, buf, MAXPATHLEN);
reduce(argv0_path);
joinpath(argv0_path, lib_python);
joinpath(argv0_path, LANDMARK);
if (!ismodule(argv0_path)) {
/* We are in the build directory so use the name of the
executable - we know that the absolute path is passed */
strncpy(progpath, prog, MAXPATHLEN);
}
else {
/* Use the location of the library as the progpath */
strncpy(progpath, buf, MAXPATHLEN);
}
} }
else { else {
/* If we're not in a framework, fall back to the old way /* If we're not in a framework, fall back to the old way
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment