Skip to content

Commit cf2ff42

Browse files
More robust kup publish (#87)
1 parent 1ff0690 commit cf2ff42

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.2.2
2+
3+
* `kup publish` returns exit code 1 if `cachix push/pin` commands fail
4+
15
# 0.2.1
26

37
* Allow arbitrary overrides of the form `kup install ... --override ... github:...`

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "kup"
7-
version = "0.2.1"
7+
version = "0.2.2"
88
description = "kup is a tool for managing installations of the K framework along with the different available semantics"
99
authors = [
1010
"Runtime Verification, Inc. <contact@runtimeverification.com>",

src/kup/__main__.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -739,11 +739,19 @@ def publish_package(cache: str, uri_or_path_with_package_name: str, keep_days: O
739739
rich.print('❗ [red]Could not find out path for package!')
740740
sys.exit(1)
741741

742-
subprocess.call(['cachix', 'push', cache, nix_store_path])
743-
pin_args = ['cachix', 'pin', cache, cache_key, nix_store_path] + (
744-
['--keep-days', str(keep_days)] if keep_days else []
745-
)
746-
subprocess.call(pin_args)
742+
try:
743+
subprocess.run(['cachix', 'push', cache, nix_store_path], check=True)
744+
except Exception:
745+
rich.print('❗ [red]Could not push binaries to cachix!')
746+
sys.exit(1)
747+
try:
748+
pin_args = ['cachix', 'pin', cache, cache_key, nix_store_path] + (
749+
['--keep-days', str(keep_days)] if keep_days else []
750+
)
751+
subprocess.run(pin_args, check=True)
752+
except Exception:
753+
rich.print('❗ [red]Could not pin package! Make sure you have cachix >=1.6')
754+
sys.exit(1)
747755

748756

749757
def print_help(subcommand: str, parser: ArgumentParser) -> None:

0 commit comments

Comments
 (0)