2018-07-21 02:44:44 +02:00
|
|
|
{ stdenv, python, fetchPypi, makeWrapper, unzip }:
|
2015-11-17 11:38:26 +01:00
|
|
|
|
|
|
|
let
|
2017-06-01 18:20:42 +02:00
|
|
|
wheel_source = fetchPypi {
|
|
|
|
pname = "wheel";
|
2018-05-28 14:23:05 +02:00
|
|
|
version = "0.31.1";
|
2017-06-01 18:20:42 +02:00
|
|
|
format = "wheel";
|
2018-05-28 14:23:05 +02:00
|
|
|
sha256 = "80044e51ec5bbf6c894ba0bc48d26a8c20a9ba629f4ca19ea26ecfcf87685f5f";
|
2015-11-17 11:38:26 +01:00
|
|
|
};
|
2017-06-01 18:20:42 +02:00
|
|
|
setuptools_source = fetchPypi {
|
|
|
|
pname = "setuptools";
|
2018-07-22 16:55:40 +02:00
|
|
|
version = "40.0.0";
|
2017-06-01 18:20:42 +02:00
|
|
|
format = "wheel";
|
2018-07-22 16:55:40 +02:00
|
|
|
sha256 = "d68abee4eed409fbe8c302ac4d8429a1ffef912cd047a903b5701c024048dd49";
|
2015-11-17 11:38:26 +01:00
|
|
|
};
|
2017-06-07 17:28:34 +02:00
|
|
|
|
2015-11-17 11:38:26 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
2017-06-01 18:20:42 +02:00
|
|
|
pname = "pip";
|
2018-07-22 16:55:40 +02:00
|
|
|
version = "18.0";
|
2017-06-01 18:20:42 +02:00
|
|
|
name = "${python.libPrefix}-bootstrapped-${pname}-${version}";
|
2015-11-17 11:38:26 +01:00
|
|
|
|
2017-06-01 18:20:42 +02:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
|
|
|
format = "wheel";
|
2018-07-22 16:55:40 +02:00
|
|
|
sha256 = "070e4bf493c7c2c9f6a08dd797dd3c066d64074c38e9e8a0fb4e6541f266d96c";
|
2015-11-17 11:38:26 +01: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}
|
|
|
|
'';
|
|
|
|
|
2015-11-18 11:44:37 +01:00
|
|
|
patchPhase = ''
|
2015-11-17 11:38:26 +01:00
|
|
|
mkdir -p $out/bin
|
2015-11-18 11:44:37 +01:00
|
|
|
'';
|
|
|
|
|
2018-01-11 18:27:04 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper unzip ];
|
|
|
|
buildInputs = [ python ];
|
2015-11-18 11:44:37 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
2015-11-17 11:38:26 +01:00
|
|
|
|
|
|
|
# install pip binary
|
2016-03-24 16:44:14 +01:00
|
|
|
echo '#!${python.interpreter}' > $out/bin/pip
|
2018-04-14 17:11:50 +02:00
|
|
|
echo 'import sys;from pip._internal import main' >> $out/bin/pip
|
2016-03-24 16:44:14 +01:00
|
|
|
echo 'sys.exit(main())' >> $out/bin/pip
|
2015-11-17 11:38:26 +01:00
|
|
|
chmod +x $out/bin/pip
|
|
|
|
|
|
|
|
# wrap binaries with PYTHONPATH
|
|
|
|
for f in $out/bin/*; do
|
|
|
|
wrapProgram $f --prefix PYTHONPATH ":" $out/${python.sitePackages}/
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
}
|