2019-05-04 16:23:59 +03:00
|
|
|
{ lib
|
2019-10-23 13:33:23 +03:00
|
|
|
, python3
|
2022-01-18 18:16:39 +03:00
|
|
|
, installShellFiles
|
2019-05-04 16:23:59 +03:00
|
|
|
}:
|
|
|
|
|
2019-10-23 13:33:23 +03:00
|
|
|
with python3.pkgs;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2020-05-31 21:35:15 +03:00
|
|
|
runtimeDeps = ps: with ps; [
|
2019-10-23 13:33:23 +03:00
|
|
|
certifi
|
|
|
|
setuptools
|
|
|
|
pip
|
|
|
|
virtualenv
|
|
|
|
virtualenv-clone
|
|
|
|
];
|
|
|
|
|
2020-05-31 21:35:15 +03:00
|
|
|
pythonEnv = python3.withPackages runtimeDeps;
|
2019-10-23 13:33:23 +03:00
|
|
|
|
|
|
|
in buildPythonApplication rec {
|
2019-03-06 20:56:44 +03:00
|
|
|
pname = "pipenv";
|
2022-04-09 03:26:58 +03:00
|
|
|
version = "2022.4.8";
|
2017-10-15 19:16:51 +03:00
|
|
|
|
2019-03-06 20:56:44 +03:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-04-09 03:26:58 +03:00
|
|
|
sha256 = "sha256-U1Yr9p2eUjj5mh4hAcNWdGscCu+l3OubioSlo+IB3g0=";
|
2019-03-06 20:56:44 +03:00
|
|
|
};
|
2017-10-15 19:16:51 +03:00
|
|
|
|
2019-03-06 20:56:44 +03:00
|
|
|
LC_ALL = "en_US.UTF-8";
|
2017-10-15 19:16:51 +03:00
|
|
|
|
2022-01-18 18:16:39 +03:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2019-10-23 13:33:23 +03:00
|
|
|
postPatch = ''
|
|
|
|
# pipenv invokes python in a subprocess to create a virtualenv
|
2020-05-29 14:47:03 +03: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.
|
2019-10-23 13:33:23 +03:00
|
|
|
substituteInPlace pipenv/core.py \
|
2020-05-29 14:47:03 +03:00
|
|
|
--replace "sys.executable" "'${pythonEnv.interpreter}'"
|
2019-10-23 13:33:23 +03:00
|
|
|
'';
|
|
|
|
|
2020-05-31 21:35:15 +03:00
|
|
|
propagatedBuildInputs = runtimeDeps python3.pkgs;
|
2017-10-15 19:16:51 +03:00
|
|
|
|
2022-01-16 16:31:42 +03:00
|
|
|
postInstall = ''
|
2022-01-18 18:16:39 +03:00
|
|
|
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 16:31:42 +03:00
|
|
|
'';
|
|
|
|
|
2019-11-13 18:28:27 +03:00
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
2019-11-13 21:10:16 +03:00
|
|
|
export HOME=$(mktemp -d)
|
2019-11-13 23:01:30 +03:00
|
|
|
cp -r --no-preserve=mode ${wheel.src} $HOME/wheel-src
|
|
|
|
$out/bin/pipenv install $HOME/wheel-src
|
2019-11-13 18:28:27 +03:00
|
|
|
'';
|
2017-10-15 19:16:51 +03:00
|
|
|
|
2019-05-04 16:23:59 +03:00
|
|
|
meta = with lib; {
|
2019-03-06 20:56:44 +03:00
|
|
|
description = "Python Development Workflow for Humans";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ berdario ];
|
|
|
|
};
|
|
|
|
}
|