Skip to content

Commit

Permalink
kpex/CLI: Make PDKPATH (needed for magic wrapper) optional
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjankoehler committed Dec 4, 2024
1 parent 0f96dbb commit c5d23f2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions kpex/kpex_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ class KpexCLI:
def parse_args(arg_list: List[str] = None) -> argparse.Namespace:
# epilog = f"See '{PROGRAM_NAME} <subcommand> -h' for help on subcommand"
epilog = """
| Variable | Example |
| -------- | -------------------- |
| PDKPATH | (e.g. $HOME/.volare) |
| PDK | (e.g. sky130A) |
| Variable | Example | Description |
| -------- | -------------------- | --------------------------------------- |
| PDKPATH | (e.g. $HOME/.volare) | Optional (required for default magigrc) |
| PDK | (e.g. sky130A) | Optional (required for default magigrc) |
"""
epilog_md = rich.console.Group(
rich.text.Text('Environmental variables:', style='argparse.groups'),
Expand Down Expand Up @@ -199,7 +199,10 @@ def parse_args(arg_list: List[str] = None) -> argparse.Namespace:
action='store_true', default=False,
help="FasterCap -pj Use Jacobi preconditioner (default is %(default)s)")

default_magicrc_path = os.path.abspath(f"{os.environ['PDKPATH']}/libs.tech/magic/{os.environ['PDK']}.magicrc")
PDKPATH = os.environ.get('PDKPATH', None)
default_magicrc_path = \
None if PDKPATH is None \
else os.path.abspath(f"{PDKPATH}/libs.tech/magic/{os.environ['PDK']}.magicrc")
group_magic = main_parser.add_argument_group("MAGIC options")
group_magic.add_argument('--magicrc', dest='magicrc_path', default=default_magicrc_path,
help=f"Path to magicrc configuration file (default is '%(default)s')")
Expand Down

0 comments on commit c5d23f2

Please sign in to comment.