2015-11-17 11:38:26 +01:00
|
|
|
{ stdenv, python, fetchurl, makeWrapper, unzip }:
|
|
|
|
|
|
|
|
let
|
|
|
|
wheel_source = fetchurl {
|
2016-02-08 20:47:23 +01:00
|
|
|
url = "https://pypi.python.org/packages/py2.py3/w/wheel/wheel-0.29.0-py2.py3-none-any.whl";
|
|
|
|
sha256 = "ea8033fc9905804e652f75474d33410a07404c1a78dd3c949a66863bd1050ebd";
|
2015-11-17 11:38:26 +01:00
|
|
|
};
|
|
|
|
setuptools_source = fetchurl {
|
2016-01-23 12:09:44 +01:00
|
|
|
url = "https://pypi.python.org/packages/3.5/s/setuptools/setuptools-19.4-py2.py3-none-any.whl";
|
|
|
|
sha256 = "0801e6d862ca4ce24d918420d62f07ee2fe736dc016e3afa99d2103e7a02e9a6";
|
2015-11-17 11:38:26 +01:00
|
|
|
};
|
2016-03-24 16:44:14 +01:00
|
|
|
argparse_source = fetchurl {
|
|
|
|
url = "https://pypi.python.org/packages/2.7/a/argparse/argparse-1.4.0-py2.py3-none-any.whl";
|
|
|
|
sha256 = "0533cr5w14da8wdb2q4py6aizvbvsdbk3sj7m1jx9lwznvnlf5n3";
|
|
|
|
};
|
2015-11-17 11:38:26 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "python-${python.version}-bootstrapped-pip-${version}";
|
2016-03-23 22:58:48 +01:00
|
|
|
version = "8.1.1";
|
2015-11-17 11:38:26 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://pypi.python.org/packages/py2.py3/p/pip/pip-${version}-py2.py3-none-any.whl";
|
2016-03-23 22:58:48 +01:00
|
|
|
sha256 = "0p62v87lm595kwmxrnqxc81dr7h6maaxj1y28b00bf9ag11c7fa4";
|
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}
|
2016-03-24 16:44:14 +01:00
|
|
|
'' + stdenv.lib.optionalString (python.isPy26 or false) ''
|
|
|
|
unzip -d $out/${python.sitePackages} ${argparse_source}
|
2015-11-17 11:38:26 +01:00
|
|
|
'';
|
|
|
|
|
2016-03-24 16:44:14 +01:00
|
|
|
|
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
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = [ python makeWrapper unzip ];
|
|
|
|
|
|
|
|
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
|
|
|
|
echo 'import sys;from pip import main' >> $out/bin/pip
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
}
|