about summary refs log tree commit diff
path: root/pkgs/development/python-modules/tuf/default.nix
blob: 2572c4ed8cd74eb8d6e963a26517a1068c48a746 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ lib
, buildPythonPackage
, ed25519
, fetchFromGitHub
, hatchling
, pytestCheckHook
, pythonOlder
, requests
, securesystemslib
}:

buildPythonPackage rec {
  pname = "tuf";
  version = "3.1.1";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "theupdateframework";
    repo = "python-tuf";
    rev = "refs/tags/v${version}";
    hash = "sha256-HiF/b6aOhDhhQqYx/bjMXHABxmAJY4vkLlTheiL8zEo=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "hatchling==" "hatchling>="
  '';

  nativeBuildInputs = [
    hatchling
  ];

  propagatedBuildInputs = [
    requests
    securesystemslib
  ] ++ securesystemslib.optional-dependencies.pynacl
  ++ securesystemslib.optional-dependencies.crypto;

  nativeCheckInputs = [
    ed25519
    pytestCheckHook
  ];

  pythonImportsCheck = [
    "tuf"
  ];

  preCheck = ''
    cd tests
  '';

  meta = with lib; {
    description = "Python reference implementation of The Update Framework (TUF)";
    homepage = "https://github.com/theupdateframework/python-tuf";
    changelog = "https://github.com/theupdateframework/python-tuf/blob/v${version}/docs/CHANGELOG.md";
    license = with licenses; [ asl20 mit ];
    maintainers = with maintainers; [ fab ];
  };
}