1{
2 lib,
3 buildPythonPackage,
4 ed25519,
5 fetchFromGitHub,
6 hatchling,
7 pytestCheckHook,
8 pythonOlder,
9 requests,
10 securesystemslib,
11}:
12
13buildPythonPackage rec {
14 pname = "tuf";
15 version = "3.1.1";
16 pyproject = true;
17
18 disabled = pythonOlder "3.8";
19
20 src = fetchFromGitHub {
21 owner = "theupdateframework";
22 repo = "python-tuf";
23 rev = "refs/tags/v${version}";
24 hash = "sha256-HiF/b6aOhDhhQqYx/bjMXHABxmAJY4vkLlTheiL8zEo=";
25 };
26
27 postPatch = ''
28 substituteInPlace pyproject.toml \
29 --replace-fail "hatchling==" "hatchling>="
30 '';
31
32 nativeBuildInputs = [ hatchling ];
33
34 propagatedBuildInputs = [
35 requests
36 securesystemslib
37 ] ++ securesystemslib.optional-dependencies.pynacl ++ securesystemslib.optional-dependencies.crypto;
38
39 nativeCheckInputs = [
40 ed25519
41 pytestCheckHook
42 ];
43
44 pythonImportsCheck = [ "tuf" ];
45
46 preCheck = ''
47 cd tests
48 '';
49
50 meta = with lib; {
51 description = "Python reference implementation of The Update Framework (TUF)";
52 homepage = "https://github.com/theupdateframework/python-tuf";
53 changelog = "https://github.com/theupdateframework/python-tuf/blob/v${version}/docs/CHANGELOG.md";
54 license = with licenses; [
55 asl20
56 mit
57 ];
58 maintainers = with maintainers; [ fab ];
59 };
60}