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