1{ lib, buildPythonPackage, fetchFromGitHub, isPy27, pythonOlder, fetchpatch
2, cachecontrol
3, cachy
4, cleo
5, clikit
6, html5lib
7, httpretty
8, importlib-metadata
9, intreehooks
10, jsonschema
11, keyring
12, lockfile
13, pexpect
14, pkginfo
15, pygments
16, pyparsing
17, pyrsistent
18, pytestCheckHook
19, pytestcov
20, pytest-mock
21, requests
22, requests-toolbelt
23, shellingham
24, tomlkit
25}:
26
27buildPythonPackage rec {
28 pname = "poetry";
29 version = "1.0.10";
30 format = "pyproject";
31 disabled = isPy27;
32
33 src = fetchFromGitHub {
34 owner = "python-poetry";
35 repo = pname;
36 rev = version;
37 sha256 = "00qfzjjs6clh93gfl1px3ma9km8qxl3f4z819nmyl58zc8ni3zyv";
38 };
39
40 postPatch = ''
41 substituteInPlace pyproject.toml \
42 --replace "pyrsistent = \"^0.14.2\"" "pyrsistent = \"^0.16.0\"" \
43 --replace "requests-toolbelt = \"^0.8.0\"" "requests-toolbelt = \"^0.9.1\"" \
44 --replace 'importlib-metadata = {version = "~1.1.3", python = "<3.8"}' \
45 'importlib-metadata = {version = ">=1.3,<2", python = "<3.8"}' \
46 --replace "tomlkit = \"^0.5.11\"" "tomlkit = \"<2\"" \
47 --replace "cleo = \"^0.7.6\"" "cleo = \"^0.8.0\"" \
48 --replace "version = \"^20.0.1\", python = \"^3.5\"" "version = \"^21.0.0\", python = \"^3.5\"" \
49 --replace "clikit = \"^0.4.2\"" "clikit = \"^0.6.2\""
50 '';
51
52 nativeBuildInputs = [ intreehooks ];
53
54 propagatedBuildInputs = [
55 cachecontrol
56 cachy
57 cleo
58 clikit
59 html5lib
60 jsonschema
61 keyring
62 lockfile
63 pexpect
64 pkginfo
65 pyparsing
66 pyrsistent
67 requests
68 requests-toolbelt
69 shellingham
70 tomlkit
71 ] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
72
73 postInstall = ''
74 mkdir -p "$out/share/bash-completion/completions"
75 "$out/bin/poetry" completions bash > "$out/share/bash-completion/completions/poetry"
76 mkdir -p "$out/share/zsh/vendor-completions"
77 "$out/bin/poetry" completions zsh > "$out/share/zsh/vendor-completions/_poetry"
78 mkdir -p "$out/share/fish/vendor_completions.d"
79 "$out/bin/poetry" completions fish > "$out/share/fish/vendor_completions.d/poetry.fish"
80 '';
81
82 checkInputs = [ pytestCheckHook httpretty pytest-mock pygments pytestcov ];
83 preCheck = "export HOME=$TMPDIR";
84 disabledTests = [
85 # touches network
86 "git"
87 "solver"
88 "load"
89 "vcs"
90 "prereleases_if_they_are_compatible"
91 # requires git history to work correctly
92 "default_with_excluded_data"
93 # toml ordering has changed
94 "lock"
95 ];
96
97 meta = with lib; {
98 homepage = "https://python-poetry.org/";
99 description = "Python dependency management and packaging made easy";
100 license = licenses.mit;
101 maintainers = with maintainers; [ jakewaksbaum ];
102 };
103}