nixpkgs/pkgs/development/tools/pipenv/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

91 lines
1.8 KiB
Nix
Raw Normal View History

{ lib
2022-09-06 16:57:33 +00:00
, stdenv
, python3
, fetchFromGitHub
, installShellFiles
}:
with python3.pkgs;
let
runtimeDeps = ps: with ps; [
certifi
setuptools
pip
virtualenv
virtualenv-clone
2022-09-06 16:57:33 +00:00
]
++ lib.optionals stdenv.hostPlatform.isAndroid [
pyjnius
];
pythonEnv = python3.withPackages runtimeDeps;
in buildPythonApplication rec {
pname = "pipenv";
2023-02-06 23:40:33 +00:00
version = "2023.2.4";
format = "pyproject";
2017-10-15 16:16:51 +00:00
src = fetchFromGitHub {
owner = "pypa";
repo = "pipenv";
rev = "refs/tags/v${version}";
hash = "sha256-jZOBu4mWyu8U6CGqtYgfcCCDSa0pGqoZEFnXl5IO+JY=";
};
2017-10-15 16:16:51 +00:00
env.LC_ALL = "en_US.UTF-8";
2017-10-15 16:16:51 +00:00
nativeBuildInputs = [
installShellFiles
setuptools
wheel
];
postPatch = ''
# pipenv invokes python in a subprocess to create a virtualenv
2020-05-29 11:47:03 +00:00
# and to call setup.py.
# It would use sys.executable, which in our case points to a python that
# does not have the required dependencies.
substituteInPlace pipenv/core.py \
2020-05-29 11:47:03 +00:00
--replace "sys.executable" "'${pythonEnv.interpreter}'"
'';
propagatedBuildInputs = runtimeDeps python3.pkgs;
2017-10-15 16:16:51 +00:00
preCheck = ''
export HOME="$TMPDIR"
'';
nativeCheckInputs = [
mock
pytestCheckHook
pytest-xdist
pytz
requests
];
disabledTests = [
"test_convert_deps_to_pip"
"test_download_file"
];
disabledTestPaths = [
"tests/integration"
];
2022-01-16 13:31:42 +00:00
postInstall = ''
installShellCompletion --cmd pipenv \
--bash <(_PIPENV_COMPLETE=bash_source $out/bin/pipenv) \
--zsh <(_PIPENV_COMPLETE=zsh_source $out/bin/pipenv) \
--fish <(_PIPENV_COMPLETE=fish_source $out/bin/pipenv)
2022-01-16 13:31:42 +00:00
'';
meta = with lib; {
description = "Python Development Workflow for Humans";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ berdario ];
};
}