2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
2022-09-09 14:08:57 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, python3
|
2023-07-15 17:15:38 +00:00
|
|
|
, fetchPypi
|
2022-01-19 23:45:15 +00:00
|
|
|
, installShellFiles
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
with python3.pkgs;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
runtimeDeps = ps: with ps; [
|
2020-04-24 23:36:52 +00:00
|
|
|
certifi
|
|
|
|
setuptools
|
|
|
|
pip
|
|
|
|
virtualenv
|
|
|
|
virtualenv-clone
|
2022-09-09 14:08:57 +00:00
|
|
|
]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isAndroid [
|
|
|
|
pyjnius
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
pythonEnv = python3.withPackages runtimeDeps;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
in buildPythonApplication rec {
|
|
|
|
pname = "pipenv";
|
2023-02-09 11:40:11 +00:00
|
|
|
version = "2023.2.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2023-02-09 11:40:11 +00:00
|
|
|
sha256 = "sha256-GKPrpRnjbVnw1af5xCvSaFIeS5t7PRvWrc8TFWkyMnU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
LC_ALL = "en_US.UTF-8";
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
# pipenv invokes python in a subprocess to create a virtualenv
|
2020-06-02 18:00:15 +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.
|
2020-04-24 23:36:52 +00:00
|
|
|
substituteInPlace pipenv/core.py \
|
2020-06-02 18:00:15 +00:00
|
|
|
--replace "sys.executable" "'${pythonEnv.interpreter}'"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
propagatedBuildInputs = runtimeDeps python3.pkgs;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-19 23:45:15 +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)
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
cp -r --no-preserve=mode ${wheel.src} $HOME/wheel-src
|
|
|
|
$out/bin/pipenv install $HOME/wheel-src
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python Development Workflow for Humans";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ berdario ];
|
|
|
|
};
|
|
|
|
}
|