summaryrefslogtreecommitdiffstats
path: root/PC/bdist_wininst/install.c
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2005-02-03 20:11:28 (GMT)
committerThomas Heller <theller@ctypes.org>2005-02-03 20:11:28 (GMT)
commit8abe7bfb2f5b231a71f9bd10d2c52680c545f87a (patch)
tree75990b970e86447a75801ebda7a2a308fad7ffe4 /PC/bdist_wininst/install.c
parente4772f3ada185a40232c2e2c9a74694e815c9574 (diff)
downloadcpython-8abe7bfb2f5b231a71f9bd10d2c52680c545f87a.zip
cpython-8abe7bfb2f5b231a71f9bd10d2c52680c545f87a.tar.gz
cpython-8abe7bfb2f5b231a71f9bd10d2c52680c545f87a.tar.bz2
Set PYTHONHOME before loading Python, so that sys.path will be set correctly.
Already backported.
Diffstat (limited to 'PC/bdist_wininst/install.c')
-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 e6e6731..eb65d4c 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,