Skip to content

Commit 8b40b6e

Browse files
committed
Fix the loading of initHook.py, use Python loading mechanism directly.
1 parent b17222e commit 8b40b6e

File tree

9 files changed

+12
-48
lines changed

9 files changed

+12
-48
lines changed

bora/python/__init__.py

Whitespace-only changes.

bora/python/meson.build

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
py.install_sources(
2+
'__init__.py',
23
'initHook.py',
34
subdir: 'coriolis/bora',
45
)

bora/src/BoraEngine.cpp

+3-16
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,9 @@ namespace Bora {
110110

111111
void BoraEngine::_runBoraInit ()
112112
{
113-
Utilities::Path pythonSitePackages = System::getPath("pythonSitePackages");
114-
Utilities::Path confFile = "coriolis/bora/initHook.py";
115-
Utilities::Path systemConfFile = pythonSitePackages / confFile;
116-
117-
if (systemConfFile.exists()) {
118-
//Isobar::Script::addPath( systemConfDir.toString() );
119-
120-
dbo_ptr<Isobar::Script> script = Isobar::Script::create( confFile.toPyModPath() );
121-
script->addKwArgument( "bora" , (PyObject*)PyBoraEngine_Link(this) );
122-
script->runFunction ( "boraHook", getCell() );
123-
124-
//Isobar::Script::removePath( systemConfDir.toString() );
125-
} else {
126-
cerr << Warning( "Bora system configuration file:\n <%s> not found."
127-
, systemConfFile.toString().c_str() ) << endl;
128-
}
113+
dbo_ptr<Isobar::Script> script = Isobar::Script::create( "coriolis.bora.initHook" );
114+
script->addKwArgument( "bora" , (PyObject*)PyBoraEngine_Link(this) );
115+
script->runFunction ( "boraHook", getCell() );
129116
}
130117

131118

katana/python/__init__.py

Whitespace-only changes.

katana/python/meson.build

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
py.install_sources(
2+
'__init__.py',
23
'initHook.py',
34
subdir: 'coriolis/katana',
45
)

katana/src/KatanaEngine.cpp

+3-16
Original file line numberDiff line numberDiff line change
@@ -221,22 +221,9 @@ namespace Katana {
221221

222222
void KatanaEngine::_runKatanaInit ()
223223
{
224-
Utilities::Path pythonSitePackages = System::getPath( "pythonSitePackages" );
225-
Utilities::Path confFile = "coriolis/katana/initHook.py";
226-
Utilities::Path systemConfFile = pythonSitePackages / confFile;
227-
228-
if (systemConfFile.exists()) {
229-
//Isobar::Script::addPath( systemConfDir.toString() );
230-
231-
dbo_ptr<Isobar::Script> script = Isobar::Script::create( confFile.toPyModPath() );
232-
script->addKwArgument( "katana" , (PyObject*)PyKatanaEngine_Link(this) );
233-
script->runFunction ( "katanaHook", getCell() );
234-
235-
//Isobar::Script::removePath( systemConfDir.toString() );
236-
} else {
237-
cerr << Warning( "Katana system configuration file:\n <%s> not found."
238-
, systemConfFile.toString().c_str() ) << endl;
239-
}
224+
dbo_ptr<Isobar::Script> script = Isobar::Script::create( "coriolis.katana.initHook" );
225+
script->addKwArgument( "katana" , (PyObject*)PyKatanaEngine_Link(this) );
226+
script->runFunction ( "katanaHook", getCell() );
240227
}
241228

242229

unicorn/python/__init__.py

Whitespace-only changes.

unicorn/python/meson.build

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
py.install_sources(
2+
'__init__.py',
23
'initHook.py',
34
subdir: 'coriolis/unicorn',
45
)

unicorn/src/UnicornGui.cpp

+3-16
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,9 @@ namespace Unicorn {
118118

119119
void UnicornGui::_runUnicornInit ()
120120
{
121-
Utilities::Path pythonSitePackages = System::getPath("pythonSitePackages");
122-
Utilities::Path confFile = "coriolis/unicorn/initHook.py";
123-
Utilities::Path systemConfFile = pythonSitePackages / confFile;
124-
125-
if (systemConfFile.exists()) {
126-
//Isobar::Script::addPath( systemConfDir.toString() );
127-
128-
dbo_ptr<Isobar::Script> script = Isobar::Script::create( confFile.toPyModPath() );
129-
script->addKwArgument( "editor" , (PyObject*)PyCellViewer_Link(this) );
130-
script->runFunction ( "unicornConfigure", getCell() );
131-
132-
//Isobar::Script::removePath( systemConfDir.toString() );
133-
} else {
134-
cerr << Warning("Unicorn system configuration file:\n <%s> not found."
135-
,systemConfFile.toString().c_str()) << endl;
136-
}
121+
dbo_ptr<Isobar::Script> script = Isobar::Script::create( "coriolis.unicorn.initHook" );
122+
script->addKwArgument( "editor" , (PyObject*)PyCellViewer_Link(this) );
123+
script->runFunction ( "unicornConfigure", getCell() );
137124
}
138125

139126

0 commit comments

Comments
 (0)