diff -cr Python-2.3/Include/pythonrun.h Python-2.3_bt/Include/pythonrun.h *** Python-2.3/Include/pythonrun.h Thu Feb 13 17:07:52 2003 --- Python-2.3_bt/Include/pythonrun.h Tue Sep 9 11:32:43 2003 *************** *** 23,28 **** --- 23,29 ---- PyAPI_FUNC(char *) Py_GetPythonHome(void); PyAPI_FUNC(void) Py_Initialize(void); + PyAPI_FUNC(void) Py_InitializeX(void); PyAPI_FUNC(void) Py_Finalize(void); PyAPI_FUNC(int) Py_IsInitialized(void); PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void); *************** *** 88,93 **** --- 89,95 ---- PyAPI_FUNC(char *) Py_GetPrefix(void); PyAPI_FUNC(char *) Py_GetExecPrefix(void); PyAPI_FUNC(char *) Py_GetPath(void); + PyAPI_FUNC(void) Py_SetSysPaths(const char*, const char*, const char*, const char*); /* In their own files */ PyAPI_FUNC(const char *) Py_GetVersion(void); diff -cr Python-2.3/Makefile.pre.in Python-2.3_bt/Makefile.pre.in *** Python-2.3/Makefile.pre.in Sun Jul 13 06:10:42 2003 --- Python-2.3_bt/Makefile.pre.in Wed Aug 20 14:30:42 2003 *************** *** 739,750 **** else true; \ fi; \ done @for i in $(srcdir)/Include/*.h; \ do \ echo $(INSTALL_DATA) $$i $(INCLUDEPY); \ $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \ done - $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h # Install the library and miscellaneous stuff needed for extending/embedding # This goes into $(exec_prefix) --- 739,750 ---- else true; \ fi; \ done + $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h @for i in $(srcdir)/Include/*.h; \ do \ echo $(INSTALL_DATA) $$i $(INCLUDEPY); \ $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \ done # Install the library and miscellaneous stuff needed for extending/embedding # This goes into $(exec_prefix) diff -cr Python-2.3/Modules/getpath.c Python-2.3_bt/Modules/getpath.c *** Python-2.3/Modules/getpath.c Tue Dec 31 07:45:12 2002 --- Python-2.3_bt/Modules/getpath.c Tue Sep 9 11:32:25 2003 *************** *** 617,622 **** --- 617,649 ---- /* External interface */ + void + Py_SetSysPaths(const char* module_path, const char* prefiX, + const char* execprefix, const char* fullpath) + { + if (prefix) + strncpy(prefix, prefiX, MAXPATHLEN); + + if (execprefix) + strncpy(exec_prefix, execprefix, MAXPATHLEN); + + if (fullpath) + strncpy(progpath, fullpath, MAXPATHLEN); + + if (module_path) { + module_search_path = PyMem_Malloc(strlen(module_path) + 1); + if (module_search_path != NULL) { + strcpy(module_search_path, module_path); + } + else { + /* if the module_path can't be set, reset everyting + else as well and we'll fall back to the old way of + doing things. */ + prefix[0] = exec_prefix[0] = progpath[0] = '\0'; + } + } + } + char * Py_GetPath(void) { diff -cr Python-2.3/Python/pythonrun.c Python-2.3_bt/Python/pythonrun.c *** Python-2.3/Python/pythonrun.c Tue Jul 15 21:54:38 2003 --- Python-2.3_bt/Python/pythonrun.c Tue Sep 9 11:08:58 2003 *************** *** 136,160 **** } void ! Py_Initialize(void) { PyInterpreterState *interp; PyThreadState *tstate; PyObject *bimod, *sysmod; - char *p; extern void _Py_ReadyTypes(void); if (initialized) return; initialized = 1; - if ((p = Py_GETENV("PYTHONDEBUG")) && *p != '\0') - Py_DebugFlag = add_flag(Py_DebugFlag, p); - if ((p = Py_GETENV("PYTHONVERBOSE")) && *p != '\0') - Py_VerboseFlag = add_flag(Py_VerboseFlag, p); - if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0') - Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p); - interp = PyInterpreterState_New(); if (interp == NULL) Py_FatalError("Py_Initialize: can't make first interpreter"); --- 136,152 ---- } void ! Py_InitializeX(void) { PyInterpreterState *interp; PyThreadState *tstate; PyObject *bimod, *sysmod; extern void _Py_ReadyTypes(void); if (initialized) return; initialized = 1; interp = PyInterpreterState_New(); if (interp == NULL) Py_FatalError("Py_Initialize: can't make first interpreter"); *************** *** 244,249 **** --- 236,259 ---- setlocale(LC_CTYPE, saved_locale); } #endif + } + + void + Py_Initialize(void) + { + char *p; + + if (initialized) + return; + + if ((p = Py_GETENV("PYTHONDEBUG")) && *p != '\0') + Py_DebugFlag = add_flag(Py_DebugFlag, p); + if ((p = Py_GETENV("PYTHONVERBOSE")) && *p != '\0') + Py_VerboseFlag = add_flag(Py_VerboseFlag, p); + if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0') + Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p); + + Py_InitializeX(); } #ifdef COUNT_ALLOCS