diff --git a/kpex/kpex_cli.py b/kpex/kpex_cli.py index 66b7081f..266bd23f 100755 --- a/kpex/kpex_cli.py +++ b/kpex/kpex_cli.py @@ -87,10 +87,10 @@ class KpexCLI: def parse_args(arg_list: List[str] = None) -> argparse.Namespace: # epilog = f"See '{PROGRAM_NAME} -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'), @@ -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')")