nixpkgs/pkgs/development/python-modules/poetry/default.nix

102 lines
2.6 KiB
Nix
Raw Normal View History

{ lib, buildPythonPackage, fetchFromGitHub, isPy27, pythonOlder
2019-01-07 18:25:57 +00:00
, cachecontrol
, cachy
, cleo
2020-02-22 18:25:57 +00:00
, clikit
, html5lib
, httpretty
2020-02-22 18:25:57 +00:00
, importlib-metadata
, intreehooks
, jsonschema
, keyring
2020-02-22 18:25:57 +00:00
, lockfile
, pexpect
, pkginfo
, pygments
, pyparsing
, pyrsistent
, pytestCheckHook
, pytestcov
, pytest-mock
, requests
, requests-toolbelt
, shellingham
, tomlkit
2019-01-07 18:25:57 +00:00
}:
buildPythonPackage rec {
2019-01-07 18:25:57 +00:00
pname = "poetry";
version = "1.0.9";
2020-03-02 18:12:04 +00:00
format = "pyproject";
disabled = isPy27;
2019-01-07 18:25:57 +00:00
src = fetchFromGitHub {
owner = "python-poetry";
repo = pname;
rev = version;
sha256 = "0gi1li55rim60hf1gdpgpx84zlkaj0wv12wbv7dib9malhfj3pnz";
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.16.0\"" \
--replace "requests-toolbelt = \"^0.8.0\"" "requests-toolbelt = \"^0.9.1\"" \
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"}' \
--replace "tomlkit = \"^0.5.11\"" "tomlkit = \"^0.6.0\"" \
--replace "cleo = \"^0.7.6\"" "cleo = \"^0.8.0\"" \
--replace "version = \"^20.0.1\", python = \"^3.5\"" "version = \"^21.0.0\", python = \"^3.5\"" \
--replace "clikit = \"^0.4.2\"" "clikit = \"^0.6.2\""
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 = [
cachecontrol
cachy
2020-02-22 18:25:57 +00:00
cleo
clikit
html5lib
2019-10-27 15:08:27 +00:00
jsonschema
keyring
lockfile
pexpect
2019-01-07 18:25:57 +00:00
pkginfo
pyparsing
pyrsistent
requests
requests-toolbelt
2019-01-07 18:25:57 +00:00
shellingham
tomlkit
] ++ 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"
'';
checkInputs = [ pytestCheckHook httpretty pytest-mock pygments pytestcov ];
preCheck = "export HOME=$TMPDIR";
disabledTests = [
# touches network
"git"
"solver"
"load"
"vcs"
"prereleases_if_they_are_compatible"
# requires git history to work correctly
"default_with_excluded_data"
];
2019-01-07 18:25:57 +00:00
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 ];
};
}