Skip to content

Commit 912d3fb

Browse files
Update version to 1.2.4 in pyproject.toml and modify harden and verify commands to exit with appropriate status codes on errors
1 parent cb7bed5 commit 912d3fb

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

chipfoundry_cli/main.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,7 +1932,7 @@ def harden(macro, project_root, list_designs, tag, pdk, use_nix, use_docker, dry
19321932
if not librelane_venv.exists():
19331933
console.print("[red]✗[/red] LibreLane not installed")
19341934
console.print("[yellow]Run 'cf setup --only-openlane' to install LibreLane[/yellow]")
1935-
return
1935+
sys.exit(1)
19361936

19371937
# Fetch versions from upstream
19381938
console.print("[dim]Fetching version information from cf-cli repository...[/dim]")
@@ -1976,7 +1976,7 @@ def harden(macro, project_root, list_designs, tag, pdk, use_nix, use_docker, dry
19761976
if force_nix_flag and not use_nix:
19771977
console.print("[red]✗[/red] Nix not available or cannot access LibreLane flake")
19781978
console.print("[yellow]Install Nix from: https://librelane.readthedocs.io[/yellow]")
1979-
return
1979+
sys.exit(1)
19801980

19811981
# Check if Docker is available
19821982
if not use_nix and (force_docker_flag or not force_nix_flag):
@@ -1993,7 +1993,7 @@ def harden(macro, project_root, list_designs, tag, pdk, use_nix, use_docker, dry
19931993
if force_docker_flag and not use_docker:
19941994
console.print("[red]✗[/red] Docker not available")
19951995
console.print("[yellow]Install Docker from: https://docker.com[/yellow]")
1996-
return
1996+
sys.exit(1)
19971997

19981998
# Error if neither is available
19991999
if not use_nix and not use_docker:
@@ -2002,7 +2002,7 @@ def harden(macro, project_root, list_designs, tag, pdk, use_nix, use_docker, dry
20022002
console.print(" 1. [cyan]Nix[/cyan] - Install from: https://librelane.readthedocs.io")
20032003
console.print(" 2. [cyan]Docker[/cyan] - Install from: https://docker.com")
20042004
console.print("\nAfter installing either one, try again.")
2005-
return
2005+
sys.exit(1)
20062006

20072007
execution_method = "Nix" if use_nix else "Docker"
20082008

@@ -2140,9 +2140,11 @@ def harden(macro, project_root, list_designs, tag, pdk, use_nix, use_docker, dry
21402140
console.print(f"[dim]Results saved to: {project_root_path}/runs/{macro}/{tag}/[/dim]")
21412141
elif returncode == -2 or returncode == 130: # SIGINT
21422142
console.print("\n[yellow]⚠[/yellow] Hardening interrupted by user")
2143+
sys.exit(130)
21432144
else:
21442145
console.print(f"\n[red]✗[/red] [bold red]Hardening failed with exit code {returncode}[/bold red]")
21452146
console.print(f"[yellow]Check logs in: {project_root_path}/runs/{macro}/{tag}/[/yellow]")
2147+
sys.exit(returncode)
21462148

21472149
except KeyboardInterrupt:
21482150
console.print("\n[yellow]⚠[/yellow] Hardening interrupted by user")
@@ -2397,9 +2399,11 @@ def precheck(project_root, disable_lvs, checks, dry_run):
23972399
console.print("[green]✓[/green] Precheck passed!")
23982400
elif returncode == -2 or returncode == 130: # SIGINT
23992401
console.print("[yellow]⚠[/yellow] Precheck interrupted by user")
2402+
sys.exit(130)
24002403
else:
24012404
console.print(f"[red]✗[/red] Precheck failed with exit code {returncode}")
24022405
console.print(f"[yellow]Check the output above for details[/yellow]")
2406+
sys.exit(returncode)
24032407

24042408
except KeyboardInterrupt:
24052409
console.print("\n[yellow]⚠[/yellow] Precheck interrupted by user")
@@ -2533,12 +2537,12 @@ def verify(test, project_root, sim, list_tests, run_all, tag, dry_run):
25332537
if not caravel_root.exists():
25342538
console.print(f"[red]✗[/red] Caravel not found at {caravel_root}")
25352539
console.print("[yellow]Run 'cf setup --only-caravel' to install[/yellow]")
2536-
return
2540+
sys.exit(1)
25372541

25382542
if not (pdk_root / pdk).exists():
25392543
console.print(f"[red]✗[/red] PDK not found at {pdk_root / pdk}")
25402544
console.print("[yellow]Run 'cf setup --only-pdk' to install[/yellow]")
2541-
return
2545+
sys.exit(1)
25422546

25432547
# Build command
25442548
caravel_cocotb_bin = venv_cocotb / 'bin' / 'caravel_cocotb'
@@ -2599,7 +2603,7 @@ def verify(test, project_root, sim, list_tests, run_all, tag, dry_run):
25992603
if not yaml_full_path.exists():
26002604
console.print(f"[red]✗[/red] Test list file not found: {yaml_full_path}")
26012605
console.print(f"[yellow]Expected: {yaml_path}[/yellow]")
2602-
return
2606+
sys.exit(1)
26032607
cmd.extend(['-tl', yaml_path])
26042608
else:
26052609
# It's already a file path, use it as-is
@@ -2627,9 +2631,11 @@ def verify(test, project_root, sim, list_tests, run_all, tag, dry_run):
26272631
console.print(f"\n[green]✓[/green] Verification passed!")
26282632
elif returncode == -2 or returncode == 130: # SIGINT
26292633
console.print("\n[yellow]⚠[/yellow] Verification interrupted by user")
2634+
sys.exit(130)
26302635
else:
26312636
console.print(f"\n[red]✗[/red] Verification failed with exit code {returncode}")
26322637
console.print(f"[yellow]Check logs in: {cocotb_dir}[/yellow]")
2638+
sys.exit(returncode)
26332639

26342640
except KeyboardInterrupt:
26352641
console.print("\n[yellow]⚠[/yellow] Verification interrupted by user")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "chipfoundry-cli"
3-
version = "1.2.3"
3+
version = "1.2.4"
44
description = "CLI tool to automate ChipFoundry project submission to SFTP server"
55
authors = ["ChipFoundry <marwan.abbas@chipfoundry.io>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)