nixpkgs/pkgs/development/python-modules/bootstrapped-pip/default.nix
Frederik Rietdijk 9f57b6680a python.pkgs.bootstrapped-pip: updates
wheel: 0.33.1 -> 0.33.4
setuptools: 41.0.0 -> 41.0.1
pip: 19.0.3 -> 19.1.1
2019-06-15 08:46:32 +02:00

56 lines
1.4 KiB
Nix

{ stdenv, python, fetchPypi, makeWrapper, unzip }:
let
wheel_source = fetchPypi {
pname = "wheel";
version = "0.33.4";
format = "wheel";
sha256 = "5e79117472686ac0c4aef5bad5172ea73a1c2d1646b808c35926bd26bdfb0c08";
};
setuptools_source = fetchPypi {
pname = "setuptools";
version = "41.0.1";
format = "wheel";
sha256 = "c7769ce668c7a333d84e17fe8b524b1c45e7ee9f7908ad0a73e1eda7e6a5aebf";
};
in stdenv.mkDerivation rec {
pname = "pip";
version = "19.1.1";
name = "${python.libPrefix}-bootstrapped-${pname}-${version}";
src = fetchPypi {
inherit pname version;
format = "wheel";
sha256 = "993134f0475471b91452ca029d4390dc8f298ac63a712814f101cd1b6db46676";
};
unpackPhase = ''
mkdir -p $out/${python.sitePackages}
unzip -d $out/${python.sitePackages} $src
unzip -d $out/${python.sitePackages} ${setuptools_source}
unzip -d $out/${python.sitePackages} ${wheel_source}
'';
patchPhase = ''
mkdir -p $out/bin
'';
nativeBuildInputs = [ makeWrapper unzip ];
buildInputs = [ python ];
installPhase = ''
# install pip binary
echo '#!${python.interpreter}' > $out/bin/pip
echo 'import sys;from pip._internal import main' >> $out/bin/pip
echo 'sys.exit(main())' >> $out/bin/pip
chmod +x $out/bin/pip
# wrap binaries with PYTHONPATH
for f in $out/bin/*; do
wrapProgram $f --prefix PYTHONPATH ":" $out/${python.sitePackages}/
done
'';
}