3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/python-modules/bootstrapped-pip/default.nix

56 lines
1.4 KiB
Nix
Raw Normal View History

{ 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
2016-03-24 15:44:14 +00:00
echo '#!${python.interpreter}' > $out/bin/pip
echo 'import sys;from pip._internal import main' >> $out/bin/pip
2016-03-24 15:44:14 +00:00
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
'';
}