4 #include "boost/python.hpp" 13 object main_module( ( handle<>( borrowed( PyImport_AddModule(
"__main__" ) ) ) ) );
14 object main_namespace = main_module.attr(
"__dict__" );
17 main_namespace[
"PythonAdaptor"] = class_<PythonAdaptor>(
"PythonAdaptor", boost::python::init<IJobOptionsSvc*>() )
22 main_namespace[
"adaptor"] = ptr( &adaptor );
26 command +=
"\nfor name in '";
27 command += filename +
"'.split(','): execfile(name)\n";
28 command +=
"from GaudiKernel.Configurable import expandvars\nfrom GaudiKernel.Proxy.Configurable import " 29 "applyConfigurableUsers\napplyConfigurableUsers()\n";
30 command += postAction;
31 command +=
"\nfor n, c in Configurable.allConfigurables.items():\n for p, v in c.getValuedProperties().items() " 32 ":\n v = expandvars(v)\n if type(v) == str : v = '\"%s\"' % v # need double quotes\n elif " 33 "type(v) == long: v = '%d' % v # prevent pending 'L'\n adaptor.addPropertyToJobOptions(n,p,str(v))";
36 handle<> ignored( ( PyRun_String( command.
c_str(), Py_file_input, main_namespace.ptr(), main_namespace.ptr() ) ) );
37 }
catch (
const error_already_set& ) {
constexpr static const auto SUCCESS
StatusCode evaluateConfig(const std::string &filename, const std::string &preAction, const std::string &postAction)
void addPropertyToJobOptions(const std::string &client, const std::string &name, const std::string &value)
This class is used for returning status codes from appropriate routines.
constexpr static const auto FAILURE