summaryrefslogtreecommitdiff
path: root/src/sim/main.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2006-10-20 11:37:59 -0700
committerNathan Binkert <binkertn@umich.edu>2006-10-20 11:37:59 -0700
commit6c6b78126a38cf92eef89f027312e1c7a063bd18 (patch)
tree24187228b03a41781804840c0345b3438827862e /src/sim/main.cc
parentad783962c5e9ab5ee69e8b42d6c1385ef9a3b42f (diff)
downloadgem5-6c6b78126a38cf92eef89f027312e1c7a063bd18.tar.xz
Construct a correct value of PYTHONHOME from the interpreter
running SCons, make it into a sticky option that can be overridden at build time, and set it up before the interpreter is started. Also, fix the code that turns sticky options into config/*.hh so that it works with types other than bool. --HG-- extra : convert_revision : 602398b35d4da4e813f78865678ed348fdea7270
Diffstat (limited to 'src/sim/main.cc')
-rw-r--r--src/sim/main.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sim/main.cc b/src/sim/main.cc
index 8bb0d7aaa..133141e57 100644
--- a/src/sim/main.cc
+++ b/src/sim/main.cc
@@ -55,6 +55,7 @@
#include "base/statistics.hh"
#include "base/str.hh"
#include "base/time.hh"
+#include "config/pythonhome.hh"
#include "cpu/base.hh"
#include "cpu/smt.hh"
#include "mem/mem_object.hh"
@@ -145,6 +146,11 @@ main(int argc, char **argv)
if (setenv("PYTHONPATH", pythonpath.c_str(), true) == -1)
fatal("setenv: %s\n", strerror(errno));
+ char *python_home = getenv("PYTHONHOME");
+ if (!python_home)
+ python_home = PYTHONHOME;
+ Py_SetPythonHome(python_home);
+
// initialize embedded Python interpreter
Py_Initialize();
PySys_SetArgv(argc, argv);