4 #if PY_MAJOR_VERSION >= 3 6 # define PySys_SetArgv_Char_t wchar_t 10 # define PySys_SetArgv_Char_t char 25 #if defined( __linux ) 38 declareProperty(
"StartupScript", m_startupScript =
"" );
60 tmp.
assign( prpMgr->getProperty(
"JobOptionsType" ) );
61 if ( tmp.
value() ==
"NONE" ) {
62 tmp.
assign( prpMgr->getProperty(
"JobOptionsPath" ) );
69 #if PY_MAJOR_VERSION >= 3 70 wchar_t* progName[] = {const_cast<wchar_t*>( L
"GaudiPython" )};
72 char* progName[] = {const_cast<char*>(
"GaudiPython" )};
78 PySys_SetArgv( 1, progName );
82 std::string vers( version, 0, version.find_first_of(
'.', version.find_first_of(
'.' ) + 1 ) );
83 info() <<
"Python version: [" << vers <<
"]" <<
endmsg;
85 #if defined( __linux ) 90 dlopen( libname.
c_str(), RTLD_GLOBAL | RTLD_LAZY );
94 PyRun_SimpleString(
"from gaudimodule import *" );
95 PyRun_SimpleString(
"g = AppMgr()" );
97 PyRun_SimpleString(
"theApp = g" );
98 PyRun_SimpleString(
"def Service(n): return g.service(n)" );
99 PyRun_SimpleString(
"def Algorithm(n): return g.algorithm(n)" );
100 PyRun_SimpleString(
"def Property(n): return g.service(n)" );
102 #if !defined( _WIN32 ) 103 PyRun_SimpleString(
"import rlcompleter" );
104 PyRun_SimpleString(
"rlcompleter.readline.parse_and_bind('tab: complete')" );
132 buffer.
reserve( file.tellg() );
133 file.seekg( 0, std::ios::beg );
136 PyRun_SimpleString( buffer.
c_str() );
141 PyRun_InteractiveLoop( stdin,
"\0" );
StatusCode initialize() override
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
~PythonScriptingSvc() override
Destructor.
StatusCode finalize() override
Implementation of property with value of concrete type.
StatusCode run() override
Run the service by taking full control. [IRunable::run()].
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
constexpr static const auto SUCCESS
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
StatusCode finalize() override
Finalize the service. [IService::finalize()].
#define DECLARE_COMPONENT(type)
This class is used for returning status codes from appropriate routines.
const ValueType & value() const
Backward compatibility (.
std::string m_startupScript
Startup script.
T find_first_of(T... args)
This service handles scripting implemented using Python.
StatusCode initialize() override
Initialize the service. [IService::initialize()].
bool assign(const Details::PropertyBase &source) override
get the value from another property
The IProperty is the basic interface for all components which have properties that can be set or get.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.