diff options
author | Steve Reinhardt <stever@eecs.umich.edu> | 2006-05-30 19:44:57 -0400 |
---|---|---|
committer | Steve Reinhardt <stever@eecs.umich.edu> | 2006-05-30 19:44:57 -0400 |
commit | e371dc32a94b0c4ffe7192aad634b425b5b43437 (patch) | |
tree | 5a690fafbcf1eb4a6c82530c34ae98fe7663fb1a /src/sim | |
parent | 0337db3388db335ea23f02f3aa00bca9d483ef1c (diff) | |
download | gem5-e371dc32a94b0c4ffe7192aad634b425b5b43437.tar.xz |
Clean up Python embedding to build on zizzer (where python2.4
is currently in /usr/local instead of /usr).
SConstruct:
Use information from the Python interpreter used to run scons
to find the version & paths for include & library files.
This means that linking with a different interpreter requires
invoking scons with that interpreter... add comment to that effect.
src/sim/main.cc:
Check return codes of Python interpreter calls for errors.
Get rid of include of obsolete header.
--HG--
extra : convert_revision : 90916bd8690fe1e6c9afdb0dfa1aa0d352a73a46
Diffstat (limited to 'src/sim')
-rw-r--r-- | src/sim/main.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/sim/main.cc b/src/sim/main.cc index a4e8a1f77..430dd8f3a 100644 --- a/src/sim/main.cc +++ b/src/sim/main.cc @@ -146,8 +146,6 @@ echoCommandLine(int argc, char **argv, ostream &out) out << endl << endl; } -#include "config/python_build_env.hh" - int main(int argc, char **argv) { @@ -171,20 +169,25 @@ main(int argc, char **argv) // Set Python module path to include current file to find embedded // zip archive - PyRun_SimpleString("import sys"); + if (PyRun_SimpleString("import sys") != 0) + panic("Python error importing 'sys' module\n"); string pathCmd = csprintf("sys.path[1:1] = ['%s']", fileName); - PyRun_SimpleString(pathCmd.c_str()); + if (PyRun_SimpleString(pathCmd.c_str()) != 0) + panic("Python error setting sys.path\n"); // Pass compile timestamp string to Python extern const char *compileDate; // from date.cc string setCompileDate = csprintf("compileDate = '%s'", compileDate); - PyRun_SimpleString(setCompileDate.c_str()); + if (PyRun_SimpleString(setCompileDate.c_str()) != 0) + panic("Python error setting compileDate\n"); // PyRun_InteractiveLoop(stdin, "stdin"); // m5/__init__.py currently contains main argv parsing loop etc., // and will write out config.ini file before returning. - PyImport_ImportModule("defines"); - PyImport_ImportModule("m5"); + if (PyImport_ImportModule("defines") == NULL) + panic("Python error importing 'defines.py'\n"); + if (PyImport_ImportModule("m5") == NULL) + panic("Python error importing 'm5' module\n"); Py_Finalize(); configStream = simout.find("config.out"); |