Go to the documentation of this file.
   12 #include <cpython/initconfig.h> 
   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" ) );
 
   68   wchar_t* progName[] = { 
const_cast<wchar_t*
>( 
L"GaudiPython" ) };
 
   73   PyConfig_InitPythonConfig( &
config );
 
   75   status = PyConfig_SetString( &
config, &
config.program_name, progName[0] );
 
   77   status = PyConfig_SetArgv( &
config, 1, progName );
 
   78   status = Py_InitializeFromConfig( &
config );
 
   85   info() << 
"Python version: [" << vers << 
"]" << 
endmsg;
 
   87 #if defined( __linux ) 
   92   dlopen( libname.
c_str(), RTLD_GLOBAL | RTLD_LAZY );
 
   96   PyRun_SimpleString( 
"from gaudimodule import *" );
 
   97   PyRun_SimpleString( 
"g      = AppMgr()" );
 
   99   PyRun_SimpleString( 
"theApp = g" );
 
  100   PyRun_SimpleString( 
"def Service(n): return g.service(n)" );
 
  101   PyRun_SimpleString( 
"def Algorithm(n): return g.algorithm(n)" );
 
  102   PyRun_SimpleString( 
"def Property(n): return g.service(n)" );
 
  104 #if !defined( _WIN32 ) 
  105   PyRun_SimpleString( 
"import rlcompleter" );
 
  106   PyRun_SimpleString( 
"rlcompleter.readline.parse_and_bind('tab: complete')" );
 
  134       buffer.
reserve( file.tellg() );
 
  135       file.seekg( 0, std::ios::beg );
 
  138       PyRun_SimpleString( buffer.
c_str() );
 
  143   PyRun_InteractiveLoop( stdin, 
"\0" );
 
  
 
std::string m_startupScript
Startup script.
StatusCode initialize() override
bool assign(const Details::PropertyBase &source) override
get the value from another property
StatusCode finalize() override
const ValueType & value() const
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
~PythonScriptingSvc() override
Destructor.
StatusCode run() override
Run the service by taking full control. [IRunable::run()].
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
constexpr static const auto SUCCESS
StatusCode initialize() override
Initialize the service. [IService::initialize()].
#define DECLARE_COMPONENT(type)
StatusCode finalize() override
Finalize the service. [IService::finalize()].
T find_first_of(T... args)
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator