nixpkgs/pkgs/by-name/py/pyamlboot/package.nix
Sergei Trofimovich 1301e4f0b0 pyamlboot.tests: fix the eval
Without the change the eval fails as:

    $ nix build --no-link -f. pyamlboot.tests
    error:
       … while evaluating the attribute 'version'
         at pkgs/by-name/py/pyamlboot/package.nix:29:3:
           28|
           29|   passthru.tests.version = testers.testVersion {
             |   ^
           30|     package = "pyamlboot";

       … while evaluating the 'name' attribute of a derivation

       … while evaluating a branch condition
         at lib/strings.nix:2627:3:
         2626|   # First detect the common case of already valid strings, to speed those up
         2627|   if stringLength string <= 207 && okRegex string != null
             |   ^
         2628|   then unsafeDiscardStringContext string

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: expected a set but found a string: "pyamlboot"

After fixing the eval tests started failing as `--version` hardcodes 1.0.

Co-authored-by: Nick Cao <nickcao@nichi.co>
2024-11-01 15:12:24 +00:00

48 lines
954 B
Nix

{
lib,
fetchFromGitHub,
python3Packages,
testers,
pyamlboot,
}:
python3Packages.buildPythonApplication rec {
pname = "pyamlboot";
version = "1.0.0";
src = fetchFromGitHub {
owner = "superna9999";
repo = "pyamlboot";
rev = "refs/tags/${version}";
hash = "sha256-vpWq8+0ZoTkfVyx+2BbXdULFwo/Ug4U1gWArXDfnzyk=";
};
build-system = with python3Packages; [
setuptools
];
dependencies = with python3Packages; [
pyusb
wheel
setuptools
];
passthru.tests.version = testers.testVersion {
package = pyamlboot;
command = "boot.py -v";
version = "boot.py ${lib.versions.majorMinor version}";
};
meta = {
description = "Amlogic USB Boot Protocol Library";
homepage = "https://github.com/superna9999/pyamlboot";
license = with lib.licenses; [
asl20
gpl2Only
mit
];
maintainers = with lib.maintainers; [ genga898 ];
mainProgram = "boot.py";
};
}