Merge #333211: python312Packages.homf 1.0.0 → 1.1.1

This commit is contained in:
nicoo 2024-08-20 00:06:54 +00:00 committed by GitHub
commit 5f5ac6bfef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 52 additions and 3 deletions

View File

@ -1,9 +1,11 @@
{
lib,
buildPythonPackage,
callPackage,
fetchFromGitHub,
# pytestCheckHook,
pythonOlder,
versionCheckHook,
hatchling,
packaging,
@ -11,7 +13,7 @@
buildPythonPackage rec {
pname = "homf";
version = "1.0.0";
version = "1.1.1";
pyproject = true;
disabled = pythonOlder "3.8";
@ -19,13 +21,12 @@ buildPythonPackage rec {
owner = "duckinator";
repo = "homf";
rev = "refs/tags/v${version}";
hash = "sha256-PU5VjBIVSMupTBh/qvVuZSFWpBbJOylCR02lONn9/qw=";
hash = "sha256-fDH6uJ2d/Jsnuudv+Qlv1tr3slxOJWh7b4smGS32n9A=";
};
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";

View File

@ -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=";
};
}