52main(
int argc,
const char **argv)
54 py::scoped_interpreter guard;
58 auto sys = py::module::import(
"sys");
59 if (py::hasattr(sys,
"argv")) {
61 py_argv = sys.attr(
"argv");
64 sys.add_object(
"argv", py_argv);
67 auto importer = py::module_::import(
"importer");
68 importer.attr(
"install")();
71 py_argv.attr(
"clear")();
74 std::cerr <<
"Usage: gem5py SCRIPT [arg] ..." << std::endl;
79 for (
int i = 1; i < argc; i++)
80 py_argv.append(argv[i]);
83 py::eval_file(argv[1]);