Fix the loading of initHook.py, use Python loading mechanism directly.

This commit is contained in:
Jean-Paul Chaput 2023-11-21 21:45:47 +01:00
parent b17222e049
commit 8b40b6ecae
9 changed files with 12 additions and 48 deletions

0
bora/python/__init__.py Normal file
View File

View File

@ -1,4 +1,5 @@
py.install_sources(
'__init__.py',
'initHook.py',
subdir: 'coriolis/bora',
)

View File

@ -110,22 +110,9 @@ namespace Bora {
void BoraEngine::_runBoraInit ()
{
Utilities::Path pythonSitePackages = System::getPath("pythonSitePackages");
Utilities::Path confFile = "coriolis/bora/initHook.py";
Utilities::Path systemConfFile = pythonSitePackages / confFile;
if (systemConfFile.exists()) {
//Isobar::Script::addPath( systemConfDir.toString() );
dbo_ptr<Isobar::Script> script = Isobar::Script::create( confFile.toPyModPath() );
script->addKwArgument( "bora" , (PyObject*)PyBoraEngine_Link(this) );
script->runFunction ( "boraHook", getCell() );
//Isobar::Script::removePath( systemConfDir.toString() );
} else {
cerr << Warning( "Bora system configuration file:\n <%s> not found."
, systemConfFile.toString().c_str() ) << endl;
}
dbo_ptr<Isobar::Script> script = Isobar::Script::create( "coriolis.bora.initHook" );
script->addKwArgument( "bora" , (PyObject*)PyBoraEngine_Link(this) );
script->runFunction ( "boraHook", getCell() );
}

View File

View File

@ -1,4 +1,5 @@
py.install_sources(
'__init__.py',
'initHook.py',
subdir: 'coriolis/katana',
)

View File

@ -221,22 +221,9 @@ namespace Katana {
void KatanaEngine::_runKatanaInit ()
{
Utilities::Path pythonSitePackages = System::getPath( "pythonSitePackages" );
Utilities::Path confFile = "coriolis/katana/initHook.py";
Utilities::Path systemConfFile = pythonSitePackages / confFile;
if (systemConfFile.exists()) {
//Isobar::Script::addPath( systemConfDir.toString() );
dbo_ptr<Isobar::Script> script = Isobar::Script::create( confFile.toPyModPath() );
script->addKwArgument( "katana" , (PyObject*)PyKatanaEngine_Link(this) );
script->runFunction ( "katanaHook", getCell() );
//Isobar::Script::removePath( systemConfDir.toString() );
} else {
cerr << Warning( "Katana system configuration file:\n <%s> not found."
, systemConfFile.toString().c_str() ) << endl;
}
dbo_ptr<Isobar::Script> script = Isobar::Script::create( "coriolis.katana.initHook" );
script->addKwArgument( "katana" , (PyObject*)PyKatanaEngine_Link(this) );
script->runFunction ( "katanaHook", getCell() );
}

View File

View File

@ -1,4 +1,5 @@
py.install_sources(
'__init__.py',
'initHook.py',
subdir: 'coriolis/unicorn',
)

View File

@ -118,22 +118,9 @@ namespace Unicorn {
void UnicornGui::_runUnicornInit ()
{
Utilities::Path pythonSitePackages = System::getPath("pythonSitePackages");
Utilities::Path confFile = "coriolis/unicorn/initHook.py";
Utilities::Path systemConfFile = pythonSitePackages / confFile;
if (systemConfFile.exists()) {
//Isobar::Script::addPath( systemConfDir.toString() );
dbo_ptr<Isobar::Script> script = Isobar::Script::create( confFile.toPyModPath() );
script->addKwArgument( "editor" , (PyObject*)PyCellViewer_Link(this) );
script->runFunction ( "unicornConfigure", getCell() );
//Isobar::Script::removePath( systemConfDir.toString() );
} else {
cerr << Warning("Unicorn system configuration file:\n <%s> not found."
,systemConfFile.toString().c_str()) << endl;
}
dbo_ptr<Isobar::Script> script = Isobar::Script::create( "coriolis.unicorn.initHook" );
script->addKwArgument( "editor" , (PyObject*)PyCellViewer_Link(this) );
script->runFunction ( "unicornConfigure", getCell() );
}