2017-06-01 17:20:42 +01:00
|
|
|
{ stdenv, python, fetchPypi, makeWrapper, unzip }:
|
2015-11-17 10:38:26 +00:00
|
|
|
|
|
|
|
let
|
2017-06-01 17:20:42 +01:00
|
|
|
wheel_source = fetchPypi {
|
|
|
|
pname = "wheel";
|
|
|
|
version = "0.29.0";
|
|
|
|
format = "wheel";
|
2016-02-08 19:47:23 +00:00
|
|
|
sha256 = "ea8033fc9905804e652f75474d33410a07404c1a78dd3c949a66863bd1050ebd";
|
2015-11-17 10:38:26 +00:00
|
|
|
};
|
2017-06-01 17:20:42 +01:00
|
|
|
setuptools_source = fetchPypi {
|
|
|
|
pname = "setuptools";
|
|
|
|
version = "36.0.1";
|
|
|
|
format = "wheel";
|
|
|
|
sha256 = "f2900e560efc479938a219433c48f15a4ff4ecfe575a65de385eeb44f2425587";
|
2015-11-17 10:38:26 +00:00
|
|
|
};
|
2017-06-01 17:20:42 +01:00
|
|
|
argparse_source = fetchPypi {
|
|
|
|
pname = "argparse";
|
|
|
|
version = "1.4.0";
|
|
|
|
sha256 = "c31647edb69fd3d465a847ea3157d37bed1f95f19760b11a47aa91c04b666314";
|
2016-03-24 15:44:14 +00:00
|
|
|
};
|
2015-11-17 10:38:26 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
2017-06-01 17:20:42 +01:00
|
|
|
pname = "pip";
|
2016-11-14 20:58:53 +00:00
|
|
|
version = "9.0.1";
|
2017-06-01 17:20:42 +01:00
|
|
|
name = "${python.libPrefix}-bootstrapped-${pname}-${version}";
|
2015-11-17 10:38:26 +00:00
|
|
|
|
2017-06-01 17:20:42 +01:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
|
|
|
format = "wheel";
|
2016-11-14 20:58:53 +00:00
|
|
|
sha256 = "690b762c0a8460c303c089d5d0be034fb15a5ea2b75bdf565f40421f542fefb0";
|
2015-11-17 10:38:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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}
|
2016-03-24 15:44:14 +00:00
|
|
|
'' + stdenv.lib.optionalString (python.isPy26 or false) ''
|
|
|
|
unzip -d $out/${python.sitePackages} ${argparse_source}
|
2015-11-17 10:38:26 +00:00
|
|
|
'';
|
|
|
|
|
2016-03-24 15:44:14 +00:00
|
|
|
|
2015-11-18 10:44:37 +00:00
|
|
|
patchPhase = ''
|
2015-11-17 10:38:26 +00:00
|
|
|
mkdir -p $out/bin
|
2015-11-18 10:44:37 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = [ python makeWrapper unzip ];
|
|
|
|
|
|
|
|
installPhase = ''
|
2015-11-17 10:38:26 +00:00
|
|
|
|
|
|
|
# install pip binary
|
2016-03-24 15:44:14 +00:00
|
|
|
echo '#!${python.interpreter}' > $out/bin/pip
|
|
|
|
echo 'import sys;from pip import main' >> $out/bin/pip
|
|
|
|
echo 'sys.exit(main())' >> $out/bin/pip
|
2015-11-17 10:38:26 +00:00
|
|
|
chmod +x $out/bin/pip
|
|
|
|
|
|
|
|
# wrap binaries with PYTHONPATH
|
|
|
|
for f in $out/bin/*; do
|
|
|
|
wrapProgram $f --prefix PYTHONPATH ":" $out/${python.sitePackages}/
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
}
|