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

108 lines
2.6 KiB
Nix
Raw Normal View History

{ lib, buildPythonPackage, fetchFromGitHub, isPy27, pythonOlder, fetchpatch
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
, keyring
2020-02-22 18:25:57 +00:00
, lockfile
, pexpect
, pkginfo
2020-10-03 21:26:43 +01:00
, poetry-core
, pytestCheckHook
, pytestcov
, pytest-mock
, requests
, requests-toolbelt
, shellingham
, tomlkit
2020-10-03 21:26:43 +01:00
, virtualenv
2019-01-07 18:25:57 +00:00
}:
buildPythonPackage rec {
2019-01-07 18:25:57 +00:00
pname = "poetry";
2020-11-06 05:23:00 +00:00
version = "1.1.4";
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;
2020-11-06 05:23:00 +00:00
sha256 = "0lx3qpz5dad0is7ki5a4vxphvc8cm8fnv4bmrx226a6nvvaj6ahs";
2019-01-07 18:25:57 +00:00
};
postPatch = ''
2020-02-22 18:25:57 +00:00
substituteInPlace pyproject.toml \
2020-10-03 21:26:43 +01:00
--replace 'importlib-metadata = {version = "^1.6.0", python = "<3.8"}' \
'importlib-metadata = {version = ">=1.6,<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 = [
cachecontrol
cachy
2020-02-22 18:25:57 +00:00
cleo
clikit
html5lib
keyring
lockfile
pexpect
2019-01-07 18:25:57 +00:00
pkginfo
2020-10-03 21:26:43 +01:00
poetry-core
requests
requests-toolbelt
2019-01-07 18:25:57 +00:00
shellingham
tomlkit
2020-10-03 21:26:43 +01:00
virtualenv
] ++ 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"
'';
2020-10-03 21:26:43 +01:00
checkInputs = [ pytestCheckHook httpretty pytest-mock pytestcov ];
preCheck = "export HOME=$TMPDIR";
disabledTests = [
# touches network
"git"
"solver"
"load"
"vcs"
"prereleases_if_they_are_compatible"
2020-10-03 21:26:43 +01:00
"test_executor"
# requires git history to work correctly
"default_with_excluded_data"
# toml ordering has changed
"lock"
2020-10-03 21:26:43 +01:00
# fs permission errors
"test_builder_should_execute_build_scripts"
];
2019-01-07 18:25:57 +00:00
patches = [
# The following patch addresses a minor incompatibility with
# pytest-mock. This is addressed upstream in
# https://github.com/python-poetry/poetry/pull/3457
(fetchpatch {
url = "https://github.com/python-poetry/poetry/commit/8ddceb7c52b3b1f35412479707fa790e5d60e691.diff";
sha256 = "yHjFb9xJBLFOqkOZaJolKviTdtST9PMFwH9n8ud2Y+U=";
})
];
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 ];
};
}