3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/python-modules/poetry/default.nix

96 lines
2.2 KiB
Nix
Raw Normal View History

2019-01-07 18:25:57 +00:00
{ lib, buildPythonPackage, fetchPypi, callPackage
2020-02-22 18:25:57 +00:00
, isPy27, isPy34, pythonOlder
2019-01-07 18:25:57 +00:00
, cleo
, requests
, cachy
, requests-toolbelt
, pyrsistent
, pyparsing
, cachecontrol
, pkginfo
, html5lib
, shellingham
, subprocess32
2019-01-07 18:25:57 +00:00
, tomlkit
, typing
, pathlib2
, virtualenv
, functools32
2020-02-22 18:25:57 +00:00
, clikit
, keyring
, pexpect
, importlib-metadata
2019-01-07 18:25:57 +00:00
, pytest
2019-10-27 15:08:27 +00:00
, jsonschema
2020-02-22 18:25:57 +00:00
, intreehooks
, lockfile
2019-01-07 18:25:57 +00:00
}:
let
glob2 = callPackage ./glob2.nix { };
2019-01-07 18:25:57 +00:00
in buildPythonPackage rec {
pname = "poetry";
2020-03-20 10:00:08 +00:00
version = "1.0.5";
2020-03-02 18:12:04 +00:00
format = "pyproject";
2019-01-07 18:25:57 +00:00
src = fetchPypi {
inherit pname version;
2020-03-26 00:04:38 +00:00
sha256 = "02h387k0xssvv78yy82pcpknpq4w5ym2in1zl8cg9r5wljl5w6cf";
2019-01-07 18:25:57 +00:00
};
postPatch = ''
2020-02-22 18:25:57 +00:00
substituteInPlace pyproject.toml \
--replace "pyrsistent = \"^0.14.2\"" "pyrsistent = \"^0.15.0\"" \
--replace "requests-toolbelt = \"^0.8.0\"" "requests-toolbelt = \"^0.9.0\"" \
2020-03-02 18:12:04 +00:00
--replace 'importlib-metadata = {version = "~1.1.3", python = "<3.8"}' \
'importlib-metadata = {version = ">=1.3,<2", python = "<3.8"}'
2019-01-07 18:25:57 +00:00
'';
2020-02-22 18:25:57 +00:00
nativeBuildInputs = [ intreehooks ];
2019-01-07 18:25:57 +00:00
propagatedBuildInputs = [
2020-02-22 18:25:57 +00:00
cleo
clikit
2019-01-07 18:25:57 +00:00
requests
cachy
requests-toolbelt
2019-10-27 15:08:27 +00:00
jsonschema
2019-01-07 18:25:57 +00:00
pyrsistent
pyparsing
cachecontrol
pkginfo
html5lib
shellingham
tomlkit
2020-02-22 18:25:57 +00:00
pexpect
keyring
lockfile
] ++ lib.optionals (isPy27 || isPy34) [ typing pathlib2 glob2 ]
2020-02-22 18:25:57 +00:00
++ lib.optionals isPy27 [ virtualenv functools32 subprocess32 ]
++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
2019-01-07 18:25:57 +00:00
postInstall = ''
mkdir -p "$out/share/bash-completion/completions"
"$out/bin/poetry" completions bash > "$out/share/bash-completion/completions/poetry"
mkdir -p "$out/share/zsh/vendor-completions"
"$out/bin/poetry" completions zsh > "$out/share/zsh/vendor-completions/_poetry"
mkdir -p "$out/share/fish/vendor_completions.d"
"$out/bin/poetry" completions fish > "$out/share/fish/vendor_completions.d/poetry.fish"
'';
2019-01-07 18:25:57 +00:00
# No tests in Pypi tarball
doCheck = false;
checkInputs = [ pytest ];
checkPhase = ''
pytest tests
'';
meta = with lib; {
2020-02-22 18:25:57 +00:00
homepage = "https://python-poetry.org/";
2019-01-07 18:25:57 +00:00
description = "Python dependency management and packaging made easy";
license = licenses.mit;
maintainers = with maintainers; [ jakewaksbaum ];
};
}