Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate tech_name param in compiler/globals.py #210

Open
wants to merge 6 commits into
base: stable
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions compiler/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,12 +558,24 @@ def import_tech():
openram.OPENRAM_TECH = OPENRAM_TECH

# Add all of the paths
tech_found = None
for tech_path in OPENRAM_TECH.split(":"):
debug.check(os.path.isdir(tech_path),
"$OPENRAM_TECH does not exist: {}".format(tech_path))
sys.path.append(tech_path)
debug.info(1, "Adding technology path: {}".format(tech_path))

# List all tech dirs in that path and check if we can find the tech_name inside
for tech_dir in os.listdir(tech_path):
if tech_dir==OPTS.tech_name :
tech_found = tech_dir
break;

# If the tech_name param specified by the user is not present in the technology folder, emit an error and quit
if (tech_found is None):
debug.error(f"You specified \'tech_name={OPTS.tech_name}\' in your config file, but that technology is not present in the technologies folder!")
quit()

# Import the tech
try:
tech_mod = __import__(OPTS.tech_name)
Expand Down