4 #include "GaudiKernel/MsgStream.h"
5 #include "GaudiKernel/ISvcLocator.h"
6 #include "GaudiKernel/SmartIF.h"
27 declareProperty(
"StartupScript", m_startupScript =
"" );
52 if ( tmp.
value( ) ==
"NONE" ) {
59 char* progName[] = {
const_cast<char*
>(
"GaudiPython") };
64 PySys_SetArgv( 1, progName );
66 std::string fullversion = Py_GetVersion();
67 std::string version( fullversion, 0, fullversion.find_first_of(
' '));
68 std::string vers(version, 0, version.find_first_of(
'.',version.find_first_of(
'.')+1));
75 std::string libname =
"libpython" + vers +
".so";
76 dlopen(libname.c_str(), RTLD_GLOBAL | RTLD_LAZY);
81 PyRun_SimpleString(
"from gaudimodule import *" );
82 PyRun_SimpleString(
"g = AppMgr()" );
84 PyRun_SimpleString(
"theApp = g" );
85 PyRun_SimpleString(
"def Service(n): return g.service(n)" );
86 PyRun_SimpleString(
"def Algorithm(n): return g.algorithm(n)" );
87 PyRun_SimpleString(
"def Property(n): return g.service(n)" );
89 #if !defined( _WIN32 )
90 PyRun_SimpleString(
"import rlcompleter");
91 PyRun_SimpleString(
"rlcompleter.readline.parse_and_bind('tab: complete')");
118 std::stringstream stream;
121 while(
file.get(ch) ) stream.put(ch);
122 PyRun_SimpleString( const_cast<char*>(stream.str().c_str()) );
129 PyRun_InteractiveLoop(stdin,
"\0");
Definition of the MsgStream class used to transmit messages.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
virtual StatusCode getProperty(Property *p) const =0
Get the property by property.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
virtual StatusCode finalize()
Finalize the service. [IService::finalize()].
bool isFailure() const
Test for a status code of FAILURE.
#define DECLARE_COMPONENT(type)
This class is used for returning status codes from appropriate routines.
std::string m_startupScript
Startup script.
This service handles scripting implemented using Python.
virtual ~PythonScriptingSvc()
Destructor.
const TYPE & value() const
explicit conversion
virtual const std::string & name() const
Retrieve name of the service.
virtual bool assign(const Property &source)
get the value from another property
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
bool isValid() const
Allow for check if smart pointer is valid.
virtual StatusCode run()
Run the service by taking full control. [IRunable::run()].
Templated class to add the standard messaging functionalities.
virtual StatusCode initialize()
Initialize the service. [IService::initialize()].
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.