Skip to content

Commit c5b46e6

Browse files
committed
moved all submit env var checking to submit function
1 parent a8ba6fc commit c5b46e6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

chipflow_lib/steps/silicon.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,6 @@ def run_cli(self, args):
8484
raise ChipFlowError(
8585
"Key `chipflow.project_id` is not defined in chipflow.toml; "
8686
"see https://chipflow.io/beta for details on how to join the beta")
87-
# Check for CHIPFLOW_API_KEY_SECRET or CHIPFLOW_API_KEY
88-
if not os.environ.get("CHIPFLOW_API_KEY") and not os.environ.get("CHIPFLOW_API_KEY_SECRET"):
89-
raise ChipFlowError(
90-
"Environment variable `CHIPFLOW_API_KEY` must be set to submit a design."
91-
)
92-
# Log a deprecation warning if CHIPFLOW_API_KEY_SECRET is used
93-
if os.environ.get("CHIPFLOW_API_KEY_SECRET"):
94-
logger.warning(
95-
"Environment variable `CHIPFLOW_API_KEY_SECRET` is deprecated. "
96-
"Please migrate to using `CHIPFLOW_API_KEY` instead."
97-
)
9887

9988
rtlil_path = self.prepare() # always prepare before submission
10089
if args.action == "submit":
@@ -110,6 +99,17 @@ def prepare(self):
11099
def submit(self, rtlil_path, *, dry_run=False, wait=False):
111100
"""Submit the design to the ChipFlow cloud builder.
112101
"""
102+
# Check for CHIPFLOW_API_KEY_SECRET or CHIPFLOW_API_KEY
103+
if not os.environ.get("CHIPFLOW_API_KEY") and not os.environ.get("CHIPFLOW_API_KEY_SECRET"):
104+
raise ChipFlowError(
105+
"Environment variable `CHIPFLOW_API_KEY` must be set to submit a design."
106+
)
107+
# Log a deprecation warning if CHIPFLOW_API_KEY_SECRET is used
108+
if os.environ.get("CHIPFLOW_API_KEY_SECRET"):
109+
logger.warning(
110+
"Environment variable `CHIPFLOW_API_KEY_SECRET` is deprecated. "
111+
"Please migrate to using `CHIPFLOW_API_KEY` instead."
112+
)
113113
chipflow_api_key = os.environ.get("CHIPFLOW_API_KEY") or os.environ.get("CHIPFLOW_API_KEY_SECRET")
114114
if chipflow_api_key is None:
115115
raise ChipFlowError(

0 commit comments

Comments
 (0)