1{
2 lib,
3 buildPythonPackage,
4 fetchpatch2,
5 fetchPypi,
6 pythonOlder,
7 importlib-metadata,
8 keyring,
9 pkginfo,
10 readme-renderer,
11 requests,
12 requests-toolbelt,
13 rich,
14 rfc3986,
15 setuptools-scm,
16 urllib3,
17 build,
18 pretend,
19 pytest-socket,
20 pytestCheckHook,
21}:
22
23buildPythonPackage rec {
24 pname = "twine";
25 version = "5.1.1";
26 format = "pyproject";
27 disabled = pythonOlder "3.7";
28
29 src = fetchPypi {
30 inherit pname version;
31 hash = "sha256-mqCCUTnAKzQ02RNUXHuEeiHINeEVl/UlWELUV9ojIts=";
32 };
33
34 patches = [
35 # pkginfo>=1.11 compatibility patches
36 # https://github.com/pypa/twine/pull/1123
37 (fetchpatch2 {
38 name = "pkginfo-1_11-compatibility-test.patch";
39 url = "https://github.com/pypa/twine/commit/a3206073b87a8e939cf699777882ebfaced689a0.patch";
40 hash = "sha256-gLN7gJsVng/LFfsrAHjJlqFZTu0wSdeBfnUN+UnLSFk=";
41 })
42 (fetchpatch2 {
43 name = "pkginfo-1_11-compatibility-source.patch";
44 url = "https://github.com/pypa/twine/commit/03e3795659b44f263f527b0467680b238c8fbacc.patch";
45 hash = "sha256-Ne9+G8hMVbklKtcZLiBw29Skz5VO5x2F7yu/KozKgN8=";
46 })
47 ];
48
49 nativeBuildInputs = [ setuptools-scm ];
50
51 pythonRelaxDeps = [ "pkginfo" ];
52
53 propagatedBuildInputs = [
54 importlib-metadata
55 keyring
56 pkginfo
57 readme-renderer
58 requests
59 requests-toolbelt
60 rfc3986
61 rich
62 urllib3
63 ];
64
65 nativeCheckInputs = [
66 build
67 pretend
68 pytest-socket
69 pytestCheckHook
70 ];
71
72 pythonImportsCheck = [ "twine" ];
73
74 meta = {
75 description = "Collection of utilities for interacting with PyPI";
76 mainProgram = "twine";
77 homepage = "https://github.com/pypa/twine";
78 license = lib.licenses.asl20;
79 };
80}