From c447ec49eb5b31c03fcb2c7e37addd196dd3fb7e Mon Sep 17 00:00:00 2001 From: Bugra Onal Date: Thu, 23 Feb 2023 15:14:39 -0800 Subject: [PATCH] Added the new import method --- sram_char.py | 19 +++++-------------- sram_func.py | 18 ++++-------------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/sram_char.py b/sram_char.py index c5024bc2..a6968bf8 100755 --- a/sram_char.py +++ b/sram_char.py @@ -16,20 +16,11 @@ an analytical model or spice simulation is used for characterization. import sys import datetime from globals import * -try: - import openram -except: - # If openram library isn't found as a python package, - # import it from the $OPENRAM_HOME path. - import importlib.util - OPENRAM_HOME = os.getenv("OPENRAM_HOME") - # Import using spec since the directory can be named something - # other than "openram". - spec = importlib.util.spec_from_file_location("openram", "{}/../__init__.py".format(OPENRAM_HOME)) - module = importlib.util.module_from_spec(spec) - sys.modules["openram"] = module - spec.loader.exec_module(module) - import openram + +# You don't need the next two lines if you're sure that openram package is installed +from common import * +make_openram_package() +import openram (OPTS, args) = openram.parse_args() diff --git a/sram_func.py b/sram_func.py index fd152e67..3d9fecca 100755 --- a/sram_func.py +++ b/sram_func.py @@ -17,20 +17,10 @@ import sys import datetime from globals import * -try: - import openram -except: - # If openram library isn't found as a python package, - # import it from the $OPENRAM_HOME path. - import importlib.util - OPENRAM_HOME = os.getenv("OPENRAM_HOME") - # Import using spec since the directory can be named something - # other than "openram". - spec = importlib.util.spec_from_file_location("openram", "{}/../__init__.py".format(OPENRAM_HOME)) - module = importlib.util.module_from_spec(spec) - sys.modules["openram"] = module - spec.loader.exec_module(module) - import openram +# You don't need the next two lines if you're sure that openram package is installed +from common import * +make_openram_pacakage() +import openram (OPTS, args) = openram.parse_args()