Remove all usage of etc/SYS_CONF_PATH and any assumptions about the installation location

This commit is contained in:
Rob Taylor 2023-08-26 16:05:42 +01:00 committed by Rob Taylor
parent 081569b363
commit d373afeffd
12 changed files with 80 additions and 153 deletions

View File

@ -249,9 +249,6 @@ namespace CRL {
System::get(); System::get();
AllianceFramework* af = new AllianceFramework (); AllianceFramework* af = new AllianceFramework ();
af->_postCreate(); af->_postCreate();
//if (not (flags & NoPythonInit))
// System::runPythonInit();
//_singleton->bindLibraries();
} }
return _singleton; return _singleton;

View File

@ -24,9 +24,6 @@
# define __CCONFIG_H__ # define __CCONFIG_H__
/* The root directory where CORIOLIS is to be installed. */
#undef CORIOLIS_TOP
/* Define to 1 if you have the <dlfcn.h> header file. */ /* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H #undef HAVE_DLFCN_H

View File

@ -1 +0,0 @@
#cmakedefine CORIOLIS_TOP

View File

@ -56,8 +56,7 @@ namespace CRL {
// Class : "Environment". // Class : "Environment".
Environment::Environment () Environment::Environment ()
: _CORIOLIS_TOP (CORIOLIS_TOP) : _displayStyle ()
, _displayStyle ()
, _SCALE_X (10) , _SCALE_X (10)
, _IN_LO ("vst") , _IN_LO ("vst")
, _IN_PH ("ap") , _IN_PH ("ap")
@ -335,7 +334,6 @@ namespace CRL {
Record *Environment::_getRecord () const Record *Environment::_getRecord () const
{ {
Record* record = new Record ( "<Environment>" ); Record* record = new Record ( "<Environment>" );
record->add ( getSlot ( "_CORIOLIS_TOP" , &_CORIOLIS_TOP ) );
record->add ( getSlot ( "_displayStyle" , &_displayStyle ) ); record->add ( getSlot ( "_displayStyle" , &_displayStyle ) );
record->add ( getSlot ( "_SCALE_X" , &_SCALE_X ) ); record->add ( getSlot ( "_SCALE_X" , &_SCALE_X ) );
record->add ( getSlot ( "_IN_LO" , &_IN_LO ) ); record->add ( getSlot ( "_IN_LO" , &_IN_LO ) );
@ -357,7 +355,6 @@ namespace CRL {
{ {
w->startObject(); w->startObject();
jsonWrite( w, "@typename" , _getTypeName() ); jsonWrite( w, "@typename" , _getTypeName() );
jsonWrite( w, "_CORIOLIS_TOP", _CORIOLIS_TOP );
jsonWrite( w, "_displayStyle", _displayStyle ); jsonWrite( w, "_displayStyle", _displayStyle );
jsonWrite( w, "_SCALE_X" , _SCALE_X ); jsonWrite( w, "_SCALE_X" , _SCALE_X );
jsonWrite( w, "_IN_LO" , _IN_LO ); jsonWrite( w, "_IN_LO" , _IN_LO );
@ -387,7 +384,6 @@ namespace CRL {
JsonEnvironment::JsonEnvironment ( unsigned long flags ) JsonEnvironment::JsonEnvironment ( unsigned long flags )
: JsonObject(flags) : JsonObject(flags)
{ {
add( "_CORIOLIS_TOP", typeid(string) );
add( "_displayStyle", typeid(string) ); add( "_displayStyle", typeid(string) );
add( "_SCALE_X" , typeid(int64_t) ); add( "_SCALE_X" , typeid(int64_t) );
add( "_IN_LO" , typeid(string) ); add( "_IN_LO" , typeid(string) );

View File

@ -193,8 +193,8 @@ namespace CRL {
ToolEngine::ToolEngine ( Cell* cell, bool verbose ) ToolEngine::ToolEngine ( Cell* cell, bool verbose )
: Super() : Super()
, _verbose (verbose)
, _cell (cell) , _cell (cell)
, _verbose (verbose)
, _placementModificationFlag(0) , _placementModificationFlag(0)
, _routingModificationFlag (0) , _routingModificationFlag (0)
, _inRelationDestroy (false) , _inRelationDestroy (false)

View File

@ -114,9 +114,7 @@ namespace {
std::string environmentMapper ( std::string environmentName ) std::string environmentMapper ( std::string environmentName )
{ {
if ( environmentName == "HOME" ) return "home"; if ( environmentName == "STRATUS_MAPPING_NAME" ) return "stratus_mapping_name";
else if ( environmentName == "CORIOLIS_TOP" ) return "coriolis_top";
else if ( environmentName == "STRATUS_MAPPING_NAME" ) return "stratus_mapping_name";
return ""; return "";
} }
@ -254,10 +252,6 @@ namespace CRL {
// Environment variables reading. // Environment variables reading.
boptions::options_description options ("Environment Variables"); boptions::options_description options ("Environment Variables");
options.add_options() options.add_options()
( "home" , boptions::value<string>()
, "User's home directory." )
( "coriolis_top" , boptions::value<string>()->default_value(CORIOLIS_TOP)
, "The root directory of the Coriolis installation tree." )
( "stratus_mapping_name", boptions::value<string>() ( "stratus_mapping_name", boptions::value<string>()
, "Stratus virtual cells mapping." ); , "Stratus virtual cells mapping." );
@ -265,77 +259,6 @@ namespace CRL {
boptions::store ( boptions::parse_environment(options,environmentMapper), arguments ); boptions::store ( boptions::parse_environment(options,environmentMapper), arguments );
boptions::notify ( arguments ); boptions::notify ( arguments );
// Force creation of singleton at this stage.
// cerr << "In System singleton creation." << endl;
// AllianceFramework::get();
// cerr << "AllianceFramework has been allocated." << endl;
// cerr << "std::string typeid name:" << typeid(string).name() << endl;
// Check for duplicated type_info initialization.
const boptions::variable_value& value = arguments["coriolis_top"];
if ( value.value().type() != typeid(string) ) {
throw Error("type_info RTTI tree has been initialized twice.\n\n"
" This may be due to incorrect import of Python modules, please ensure\n"
" that the CRL module is always imported first."
);
}
if ( arguments.count("coriolis_top") ) {
_pathes.insert ( make_pair("coriolis_top", arguments["coriolis_top"].as<string>()) );
}
Utilities::Path sysConfDir ( SYS_CONF_DIR );
if ( not sysConfDir.absolute() ) {
if ( arguments.count("coriolis_top") ) {
// const boptions::variable_value& value = arguments["coriolis_top"];
// cerr << "value:"
// << " empty:" << boolalpha << value.empty()
// << " defaulted:" << boolalpha << value.defaulted()
// << endl;
// const type_info& info = value.value().type();
// cerr << "type_info:" << info.name()
// << " vs. " << typeid(string).name() << endl;
// cerr << "Equal:" << boolalpha << (info == typeid(std::string)) << endl;
// const type_info& info2 = typeid(string);
// cerr << (void*)&(typeid(string))
// << " vs. " << (void*)&info2
// << " vs. " << (void*)&info
// << endl;
// cerr << "any_cast<string>:" << boost::any_cast<string>(value.value()) << endl;
sysConfDir = arguments["coriolis_top"].as<string>() / sysConfDir;
} else {
cerr << Error("Environment variable CORIOLIS_TOP not set,"
" may be unable to read configuration...") << endl;
}
}
sysConfDir /= "coriolis2";
_pathes.insert ( make_pair("etc" ,sysConfDir ) );
_pathes.insert ( make_pair("home",arguments["home"].as<string>()) );
// Early setting of python pathes to be able to execute configuration scripts.
Utilities::Path pythonSitePackages ( PYTHON_SITE_PACKAGES );
pythonSitePackages = arguments["coriolis_top"].as<string>() / pythonSitePackages;
_pathes.insert ( make_pair("pythonSitePackages",pythonSitePackages.toString()) );
// Utilities::Path crlcoreDir = pythonSitePackages / "crlcore";
// Utilities::Path stratusDir = pythonSitePackages / "stratus";
// Utilities::Path cumulusDir = pythonSitePackages / "cumulus";
// Utilities::Path oroshiDir = pythonSitePackages / "oroshi";
// Utilities::Path karakazeDir = pythonSitePackages / "karakaze";
Utilities::Path etcDir = _pathes["etc"];
Isobar::Script::addPath ( etcDir.toString() );
Isobar::Script::addPath ( sysConfDir.toString() );
Isobar::Script::addPath ( pythonSitePackages.toString() );
// Isobar::Script::addPath ( crlcoreDir.toString() );
// Isobar::Script::addPath ( stratusDir.toString() );
// Isobar::Script::addPath ( cumulusDir.toString() );
// Isobar::Script::addPath ( oroshiDir.toString() );
// Isobar::Script::addPath ( karakazeDir.toString() );
// Triggers Configuration singleton creation.
Cfg::Configuration::get (); Cfg::Configuration::get ();
Cfg::getParamBool ("misc.catchCore" ,false )->registerCb ( this, catchCoreChanged ); Cfg::getParamBool ("misc.catchCore" ,false )->registerCb ( this, catchCoreChanged );
@ -349,16 +272,6 @@ namespace CRL {
Cfg::getParamInt ("misc.maxTraceLevel" ,0 )->registerCb ( this, maxTraceLevelChanged ); Cfg::getParamInt ("misc.maxTraceLevel" ,0 )->registerCb ( this, maxTraceLevelChanged );
Cfg::getParamString("stratus1.mappingName","" )->registerCb ( this, stratus1MappingNameChanged ); Cfg::getParamString("stratus1.mappingName","" )->registerCb ( this, stratus1MappingNameChanged );
// Immediate update from the configuration.
//catchCoreChanged ( Cfg::getParamBool("misc.catchCore" ) );
//verboseLevel1Changed ( Cfg::getParamBool("misc.verboseLevel1") );
//verboseLevel2Changed ( Cfg::getParamBool("misc.verboseLevel2") );
//infoChanged ( Cfg::getParamBool("misc.info" ) );
//paranoidChanged ( Cfg::getParamBool("misc.paranoid" ) );
//bugChanged ( Cfg::getParamBool("misc.bug" ) );
//logModeChanged ( Cfg::getParamBool("misc.logMode" ) );
//traceLevelChanged ( Cfg::getParamInt ("misc.traceLevel" ) );
Utilities::Path stratusMappingName; Utilities::Path stratusMappingName;
if ( arguments.count("stratus_mapping_name") ) { if ( arguments.count("stratus_mapping_name") ) {
Cfg::getParamString( "stratus1.mappingName")->setString ( arguments["stratus_mapping_name"].as<string>() ); Cfg::getParamString( "stratus1.mappingName")->setString ( arguments["stratus_mapping_name"].as<string>() );
@ -366,6 +279,7 @@ namespace CRL {
} }
System *System::get () System *System::get ()
{ {
if ( _singleton == NULL ) { if ( _singleton == NULL ) {
@ -459,37 +373,6 @@ namespace CRL {
return (*ipath).second; return (*ipath).second;
} }
void System::_runPythonInit ()
{
Utilities::Path sysConfDir = getPath("etc");
Utilities::Path pythonSitePackages = getPath("pythonSitePackages");
//bool systemConfFound = false;
Utilities::Path systemConfFile = pythonSitePackages / "crlcore" / "coriolisInit.py";
if ( systemConfFile.exists() ) {
//systemConfFound = true;
//cout << " o Reading python dot configuration:" << endl;
//cout << " - <" << systemConfFile.string() << ">." << endl;
Isobar::Script* systemScript = Isobar::Script::create(systemConfFile.stem().toString());
systemScript->runFunction("coriolisConfigure",NULL,Isobar::Script::NoScriptArgs);
systemScript->destroy();
} else {
cerr << Warning("System configuration file:\n <%s> not found."
,systemConfFile.toString().c_str()) << endl;
}
// Delayed printing, as we known only now whether VerboseLevel1 is requested.
//if ( cmess1.enabled() ) {
// cmess1 << " o Reading Configuration. " << endl;
// if (systemConfFound) cmess1 << " - <" << systemConfFile.string() << ">." << endl;
// if (homeConfFound) cmess1 << " - <" << homeConfFile.string() << ">." << endl;
// if (dotConfFound) cmess1 << " - <" << dotConfFile.string() << ">." << endl;
//}
}
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Class : "CRL::IoFile". // Class : "CRL::IoFile".

View File

@ -1 +0,0 @@
/* #undef CORIOLIS_TOP */

View File

@ -40,7 +40,6 @@ namespace CRL {
Environment (); Environment ();
~Environment (); ~Environment ();
// Accessors. // Accessors.
inline const std::string& getCORIOLIS_TOP () const;
inline const std::string& getDisplayStyle () const; inline const std::string& getDisplayStyle () const;
inline long getSCALE_X () const; inline long getSCALE_X () const;
inline const std::string& getDISPLAY () const; inline const std::string& getDISPLAY () const;
@ -90,7 +89,6 @@ namespace CRL {
Record* _getRecord () const; Record* _getRecord () const;
protected: protected:
// Internal: Attributes. // Internal: Attributes.
std::string _CORIOLIS_TOP;
std::string _displayStyle; std::string _displayStyle;
long _SCALE_X; long _SCALE_X;
std::string _IN_LO; std::string _IN_LO;
@ -117,7 +115,6 @@ namespace CRL {
// Inline Member Functions. // Inline Member Functions.
inline const std::string& Environment::getCORIOLIS_TOP () const { return _CORIOLIS_TOP; }
inline const std::string& Environment::getDisplayStyle () const { return _displayStyle; } inline const std::string& Environment::getDisplayStyle () const { return _displayStyle; }
inline long Environment::getSCALE_X () const { return _SCALE_X; } inline long Environment::getSCALE_X () const { return _SCALE_X; }
inline const std::string& Environment::getIN_LO () const { return _IN_LO; } inline const std::string& Environment::getIN_LO () const { return _IN_LO; }

View File

@ -46,7 +46,6 @@ namespace CRL {
static inline bool getCatchCore (); static inline bool getCatchCore ();
static inline const Utilities::Path& getPath ( const std::string& ); static inline const Utilities::Path& getPath ( const std::string& );
static inline bool setCatchCore ( bool catchCore ); static inline bool setCatchCore ( bool catchCore );
static inline void runPythonInit ();
private: private:
static System* _singleton; static System* _singleton;
bool _catchCore; bool _catchCore;
@ -59,14 +58,12 @@ namespace CRL {
inline bool _getCatchCore (); inline bool _getCatchCore ();
const Utilities::Path& _getPath ( const std::string& ); const Utilities::Path& _getPath ( const std::string& );
inline bool _setCatchCore ( bool catchCore ); inline bool _setCatchCore ( bool catchCore );
void _runPythonInit ();
}; };
inline bool System::getCatchCore () { return get()->_getCatchCore(); } inline bool System::getCatchCore () { return get()->_getCatchCore(); }
inline const Utilities::Path& System::getPath ( const std::string& key ) { return get()->_getPath(key); } inline const Utilities::Path& System::getPath ( const std::string& key ) { return get()->_getPath(key); }
inline bool System::setCatchCore ( bool catchCore ) { return get()->_setCatchCore(catchCore); } inline bool System::setCatchCore ( bool catchCore ) { return get()->_setCatchCore(catchCore); }
inline void System::runPythonInit () { return get()->_runPythonInit(); }
// ------------------------------------------------------------------- // -------------------------------------------------------------------

View File

@ -106,16 +106,13 @@ extern "C" {
static PyModuleDef PyCRL_ModuleDef = static PyModuleDef PyCRL_ModuleDef =
{ PyModuleDef_HEAD_INIT {
, "CRL" /* m_name */ .m_base = PyModuleDef_HEAD_INIT,
, "Coriolis Core I/O framework" .m_name = "CRL",
/* m_doc */ .m_doc = "Coriolis Core I/O framework",
, -1 /* m_size */ .m_size = -1,
, PyCRL_Methods /* m_methods */ .m_methods = PyCRL_Methods,
, NULL /* m_reload */ // .m_slots = PyCRL_Slots
, NULL /* m_traverse */
, NULL /* m_clear */
, NULL /* m_free */
}; };

View File

@ -145,7 +145,6 @@ extern "C" {
// Standart Accessors (Attributes). // Standart Accessors (Attributes).
DirectGetStringAttribute(PyEnvironment_getCORIOLIS_TOP,getCORIOLIS_TOP,PyEnvironment,Environment)
DirectGetStringAttribute(PyEnvironment_getDisplayStyle,getDisplayStyle,PyEnvironment,Environment) DirectGetStringAttribute(PyEnvironment_getDisplayStyle,getDisplayStyle,PyEnvironment,Environment)
DirectGetLongAttribute (PyEnvironment_getSCALE_X ,getSCALE_X ,PyEnvironment,Environment) DirectGetLongAttribute (PyEnvironment_getSCALE_X ,getSCALE_X ,PyEnvironment,Environment)
DirectGetStringAttribute(PyEnvironment_getIN_LO ,getIN_LO ,PyEnvironment,Environment) DirectGetStringAttribute(PyEnvironment_getIN_LO ,getIN_LO ,PyEnvironment,Environment)
@ -190,9 +189,7 @@ extern "C" {
PyMethodDef PyEnvironment_Methods[] = PyMethodDef PyEnvironment_Methods[] =
{ { "getCORIOLIS_TOP" , (PyCFunction)PyEnvironment_getCORIOLIS_TOP , METH_NOARGS { { "getDisplayStyle" , (PyCFunction)PyEnvironment_getDisplayStyle , METH_NOARGS
, "Gets the symbolic technology file." }
, { "getDisplayStyle" , (PyCFunction)PyEnvironment_getDisplayStyle , METH_NOARGS
, "Gets the name of the display style currently in use." } , "Gets the name of the display style currently in use." }
, { "getSCALE_X" , (PyCFunction)PyEnvironment_getSCALE_X , METH_NOARGS , { "getSCALE_X" , (PyCFunction)PyEnvironment_getSCALE_X , METH_NOARGS
, "Gets the SCALE_X factor (for fixed point computation)." } , "Gets the SCALE_X factor (for fixed point computation)." }

View File

@ -0,0 +1,68 @@
py.extension_module(
'Constant',
'PyConstant.cpp',
dependencies: [qt_deps, py_deps, boost, Hurricane],
include_directories: crlcore_includes
subdir: 'coriolis'
)
py.extension_module(
'CRL',
'PyCRL.cpp',
'PySystem.cpp',
'PyBanner.cpp',
'PyCatalog.cpp',
'PyCatalogState.cpp',
'PyEnvironment.cpp',
'PyAllianceLibrary.cpp',
'PyCellGauge.cpp',
'PyRoutingGauge.cpp',
'PyRoutingLayerGauge.cpp',
'PyAllianceFramework.cpp',
'PyToolBox.cpp',
'PyToolEngine.cpp',
'PyToolEngineCollection.cpp',
'PyGraphicToolEngine.cpp',
'PyAcmSigda.cpp',
'PySpice.cpp',
'PyBlif.cpp',
'PyGds.cpp',
'PyLefImport.cpp',
'PyDefImport.cpp',
'PyLefExport.cpp',
'PyDefExport.cpp',
dependencies: [qt_deps, py_deps, boost, Hurricane],
include_directories: crlcore_includes
)
py.install_sources(
'__init__.py',
'',
'helpers/__init__.py',
'helpers/io.py',
'helpers/utils.py',
'helpers/overlay.py',
'helpers/analogtechno.py',
'helpers/technology.py',
'',
'technos/__init__.py',
'technos/common',
'technos/symbolic',
'technos/node600',
'technos/node180',
'technos/node45',
subdir: 'coriolis'
)
pypathdir = meson.current_build_dir()
# Create a test script that runs a python script that uses
# the C external module. Must populate PYTHONPATH to include
# a path that includes the mymath.so dynamic library.
test('pyCRL',
py,
args : files('mymath_test.py'),
env : ['PYTHONPATH=' + pypathdir])