Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, backports-cached-property
3, buildPythonPackage
4, cachecontrol
5, cachy
6, cleo
7, crashtest
8, deepdiff
9, dulwich
10, fetchFromGitHub
11, flatdict
12, html5lib
13, httpretty
14, importlib-metadata
15, installShellFiles
16, intreehooks
17, jsonschema
18, keyring
19, lockfile
20, packaging
21, pexpect
22, pkginfo
23, platformdirs
24, poetry-core
25, poetry-plugin-export
26, pytest-mock
27, pytest-xdist
28, pytestCheckHook
29, pythonAtLeast
30, pythonOlder
31, requests
32, requests-toolbelt
33, shellingham
34, stdenv
35, tomlkit
36, urllib3
37, virtualenv
38, xattr
39}:
40
41buildPythonPackage rec {
42 pname = "poetry";
43 version = "1.2.2";
44 format = "pyproject";
45
46 disabled = pythonOlder "3.7";
47
48 src = fetchFromGitHub {
49 owner = "python-poetry";
50 repo = pname;
51 rev = "refs/tags/${version}";
52 hash = "sha256-huIjLv1T42HEmePCQNJpKnNxJKdyD9MlEtc2WRPOjRE=";
53 };
54
55 postPatch = ''
56 substituteInPlace pyproject.toml \
57 --replace 'crashtest = "^0.3.0"' 'crashtest = "*"' \
58 --replace 'xattr = { version = "^0.9.7"' 'xattr = { version = "^0.10.0"'
59 '';
60
61 nativeBuildInputs = [
62 installShellFiles
63 ];
64
65 propagatedBuildInputs = [
66 cachecontrol
67 cachy
68 cleo
69 crashtest
70 dulwich
71 html5lib
72 jsonschema
73 keyring
74 packaging
75 pexpect
76 pkginfo
77 platformdirs
78 poetry-core
79 poetry-plugin-export
80 requests
81 requests-toolbelt
82 shellingham
83 tomlkit
84 virtualenv
85 ] ++ lib.optionals (stdenv.isDarwin) [
86 xattr
87 ] ++ lib.optionals (pythonOlder "3.10") [
88 importlib-metadata
89 ] ++ lib.optionals (pythonOlder "3.8") [
90 backports-cached-property
91 ] ++ cachecontrol.optional-dependencies.filecache;
92
93 postInstall = ''
94 installShellCompletion --cmd poetry \
95 --bash <($out/bin/poetry completions bash) \
96 --fish <($out/bin/poetry completions fish) \
97 --zsh <($out/bin/poetry completions zsh) \
98 '';
99
100 checkInputs = [
101 deepdiff
102 flatdict
103 pytestCheckHook
104 httpretty
105 pytest-mock
106 pytest-xdist
107 ];
108
109 preCheck = (''
110 export HOME=$TMPDIR
111 '' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
112 # https://github.com/python/cpython/issues/74570#issuecomment-1093748531
113 export no_proxy='*';
114 '');
115
116 postCheck = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
117 unset no_proxy
118 '';
119
120 disabledTests = [
121 # touches network
122 "git"
123 "solver"
124 "load"
125 "vcs"
126 "prereleases_if_they_are_compatible"
127 "test_executor"
128 # requires git history to work correctly
129 "default_with_excluded_data"
130 # toml ordering has changed
131 "lock"
132 # fs permission errors
133 "test_builder_should_execute_build_scripts"
134 ] ++ lib.optionals (pythonAtLeast "3.10") [
135 # RuntimeError: 'auto_spec' might be a typo; use unsafe=True if this is intended
136 "test_info_setup_complex_pep517_error"
137 ];
138
139 # Allow for package to use pep420's native namespaces
140 pythonNamespaces = [
141 "poetry"
142 ];
143
144 meta = with lib; {
145 homepage = "https://python-poetry.org/";
146 description = "Python dependency management and packaging made easy";
147 license = licenses.mit;
148 maintainers = with maintainers; [ jakewaksbaum ];
149 };
150}