From f9fbeb4d0d8c193ae570ea6f0597acca9ffd0ccc Mon Sep 17 00:00:00 2001 From: nicoo Date: Thu, 8 Aug 2024 11:21:24 +0000 Subject: [PATCH 1/2] =?UTF-8?q?python3Packages.homf:=201.0.0=20=E2=86=92?= =?UTF-8?q?=201.1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.1.0 wasn't released, due to a CI/CD pipeline bug. --- pkgs/development/python-modules/homf/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/homf/default.nix b/pkgs/development/python-modules/homf/default.nix index 2e411eedc7e8..62185521fa61 100644 --- a/pkgs/development/python-modules/homf/default.nix +++ b/pkgs/development/python-modules/homf/default.nix @@ -11,7 +11,7 @@ buildPythonPackage rec { pname = "homf"; - version = "1.0.0"; + version = "1.1.1"; pyproject = true; disabled = pythonOlder "3.8"; @@ -19,7 +19,7 @@ buildPythonPackage rec { owner = "duckinator"; repo = "homf"; rev = "refs/tags/v${version}"; - hash = "sha256-PU5VjBIVSMupTBh/qvVuZSFWpBbJOylCR02lONn9/qw="; + hash = "sha256-fDH6uJ2d/Jsnuudv+Qlv1tr3slxOJWh7b4smGS32n9A="; }; build-system = [ hatchling ]; From 73fb7b0557f1b0d18c70022cfa660bb1bc78f295 Mon Sep 17 00:00:00 2001 From: nicoo Date: Thu, 8 Aug 2024 12:01:46 +0000 Subject: [PATCH 2/2] python3Packages.homf: add checks --- .../python-modules/homf/default.nix | 8 +++- .../development/python-modules/homf/tests.nix | 43 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/homf/tests.nix diff --git a/pkgs/development/python-modules/homf/default.nix b/pkgs/development/python-modules/homf/default.nix index 62185521fa61..cd58234c2349 100644 --- a/pkgs/development/python-modules/homf/default.nix +++ b/pkgs/development/python-modules/homf/default.nix @@ -1,9 +1,11 @@ { lib, buildPythonPackage, + callPackage, fetchFromGitHub, # pytestCheckHook, pythonOlder, + versionCheckHook, hatchling, packaging, @@ -25,7 +27,6 @@ buildPythonPackage rec { build-system = [ hatchling ]; pythonRelaxDeps = [ "packaging" ]; - dependencies = [ packaging ]; pythonImportsCheck = [ @@ -39,6 +40,11 @@ buildPythonPackage rec { # nativeCheckInputs = [ pytestCheckHook ]; # pytestFlagsArray = [ "-m 'not network'" ]; + nativeBuildInputs = [ versionCheckHook ]; + + # (Ab)using `callPackage` as a fix-point operator, so tests can use the `homf` drv + passthru.tests = callPackage ./tests.nix { }; + meta = with lib; { description = "Asset download tool for GitHub Releases, PyPi, etc."; mainProgram = "homf"; diff --git a/pkgs/development/python-modules/homf/tests.nix b/pkgs/development/python-modules/homf/tests.nix new file mode 100644 index 000000000000..a883334ce40d --- /dev/null +++ b/pkgs/development/python-modules/homf/tests.nix @@ -0,0 +1,43 @@ +{ + lib, + runCommand, + testers, + + cacert, + homf, +}: +let + # runs homf, putting the fetched artefacts in the drv output + Homf = + subcommand: + { + pkgName, + version, + hash, + }: + # testers.runCommand ensures we have an FOD, so the command has network access, + # yet the test is rerun whenever one of its inputs changes. + testers.runCommand { + name = "homf-${subcommand}-${pkgName}"; + script = "homf ${subcommand} --directory $out ${pkgName} ${version}"; + nativeBuildInputs = [ + cacert + homf + ]; + inherit hash; + }; +in + +lib.mapAttrs Homf { + pypi = { + pkgName = "homf"; + version = "1.1.1"; # pinned so updating homf won't invalidate hashes + hash = "sha256-zpdt7+zTaGkLG6xYoTZVw/kUek0/MrCqvljfLxNB94A="; + }; + + github = { + pkgName = "duckinator/homf"; + version = "v1.1.1"; + hash = "sha256-NeEz8wZqDWYUnrgsknXWHzhWdk8cPW8mknKS3+/dngQ="; + }; +}