summaryrefslogtreecommitdiffstats
path: root/PC/bdist_wininst/install.c
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2005-02-03 20:09:24 (GMT)
committerThomas Heller <theller@ctypes.org>2005-02-03 20:09:24 (GMT)
commit698fcf469bde83c9528e1ef90271dfa8628abd02 (patch)
treeac5a14577f0d135b9b1bbbb5ac98059358f66646 /PC/bdist_wininst/install.c
parentcc0cd71d4ee274e3f20605166144402bbf9fd352 (diff)
downloadcpython-698fcf469bde83c9528e1ef90271dfa8628abd02.zip
cpython-698fcf469bde83c9528e1ef90271dfa8628abd02.tar.gz
cpython-698fcf469bde83c9528e1ef90271dfa8628abd02.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 44a6e0e..6a9bccb 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,