summaryrefslogtreecommitdiff
path: root/PC/bdist_wininst
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2005-02-03 20:11:28 +0000
committerThomas Heller <theller@ctypes.org>2005-02-03 20:11:28 +0000
commit4e3c05854e9e467fdc90a974cf633a67862b4153 (patch)
treec41259b1b12e7ba86bb6b595b7b42cdc55a87e5b /PC/bdist_wininst
parent588b5ba3d723d8b013197b544da31b8b581b0e15 (diff)
downloadcpython-4e3c05854e9e467fdc90a974cf633a67862b4153.tar.gz
Set PYTHONHOME before loading Python, so that sys.path will be set correctly.
Already backported.
Diffstat (limited to 'PC/bdist_wininst')
-rw-r--r--PC/bdist_wininst/install.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c
index e6e673144d..eb65d4cbaf 100644
--- a/PC/bdist_wininst/install.c
+++ b/PC/bdist_wininst/install.c
@@ -613,7 +613,13 @@ static HINSTANCE LoadPythonDll(char *fname)
char fullpath[_MAX_PATH];
LONG size = sizeof(fullpath);
char subkey_name[80];
- HINSTANCE h = LoadLibrary(fname);
+ char buffer[260 + 12];
+ HINSTANCE h;
+
+ /* make sure PYTHONHOME is set, to that sys.path is initialized correctly */
+ wsprintf(buffer, "PYTHONHOME=%s", python_dir);
+ _putenv(buffer);
+ h = LoadLibrary(fname);
if (h)
return h;
wsprintf(subkey_name,