mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
python2Packages: keep separate (bootstrapped-)pip
Currently there is only one line difference regarding bootstrapped-pip, but this will change in the future with the whole Python world moving towards PEP 517.
This commit is contained in:
parent
252ae44416
commit
983c453eec
67
pkgs/development/python-modules/bootstrapped-pip/2.nix
Normal file
67
pkgs/development/python-modules/bootstrapped-pip/2.nix
Normal file
@ -0,0 +1,67 @@
|
||||
{ lib, stdenv, python, fetchPypi, makeWrapper, unzip, makeSetupHook
|
||||
, pipInstallHook
|
||||
, setuptoolsBuildHook
|
||||
, wheel, pip, setuptools
|
||||
, isPy27
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "pip";
|
||||
inherit (pip) version;
|
||||
name = "${python.libPrefix}-bootstrapped-${pname}-${version}";
|
||||
|
||||
srcs = [ wheel.src pip.src setuptools.src ];
|
||||
sourceRoot = ".";
|
||||
|
||||
dontUseSetuptoolsBuild = true;
|
||||
dontUsePipInstall = true;
|
||||
|
||||
# Should be propagatedNativeBuildInputs
|
||||
propagatedBuildInputs = [
|
||||
# Override to remove dependencies to prevent infinite recursion.
|
||||
(pipInstallHook.override{pip=null;})
|
||||
(setuptoolsBuildHook.override{setuptools=null; wheel=null;})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
mkdir -p $out/bin
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ makeWrapper unzip ];
|
||||
buildInputs = [ python ];
|
||||
|
||||
buildPhase = ":";
|
||||
|
||||
installPhase = lib.strings.optionalString (!stdenv.hostPlatform.isWindows) ''
|
||||
export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0
|
||||
'' + ''
|
||||
# Give folders a known name
|
||||
mv pip* pip
|
||||
mv setuptools* setuptools
|
||||
mv wheel* wheel
|
||||
# Set up PYTHONPATH. The above folders need to be on PYTHONPATH
|
||||
# $out is where we are installing to and takes precedence
|
||||
export PYTHONPATH="$out/${python.sitePackages}:$(pwd)/pip/src:$(pwd)/setuptools:$(pwd)/setuptools/pkg_resources:$(pwd)/wheel:$PYTHONPATH"
|
||||
|
||||
echo "Building setuptools wheel..."
|
||||
pushd setuptools
|
||||
${python.pythonForBuild.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache .
|
||||
popd
|
||||
|
||||
echo "Building wheel wheel..."
|
||||
pushd wheel
|
||||
${python.pythonForBuild.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache .
|
||||
popd
|
||||
|
||||
echo "Building pip wheel..."
|
||||
pushd pip
|
||||
${python.pythonForBuild.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache .
|
||||
popd
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Version of pip used for bootstrapping";
|
||||
license = lib.unique (pip.meta.license ++ setuptools.meta.license ++ wheel.meta.license);
|
||||
homepage = pip.meta.homepage;
|
||||
};
|
||||
}
|
44
pkgs/development/python-modules/pip/20.nix
Normal file
44
pkgs/development/python-modules/pip/20.nix
Normal file
@ -0,0 +1,44 @@
|
||||
{ lib
|
||||
, python
|
||||
, buildPythonPackage
|
||||
, bootstrapped-pip
|
||||
, fetchFromGitHub
|
||||
, mock
|
||||
, scripttest
|
||||
, virtualenv
|
||||
, pretend
|
||||
, pytest
|
||||
, setuptools
|
||||
, wheel
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pip";
|
||||
version = "20.3.4";
|
||||
format = "other";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "pypa";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "0hkhs9yc1cjdj1gn9wkycd3sy65c05q8k8rhqgsm5jbpksfssiwn";
|
||||
name = "${pname}-${version}-source";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ bootstrapped-pip ];
|
||||
|
||||
# pip detects that we already have bootstrapped_pip "installed", so we need
|
||||
# to force it a little.
|
||||
pipInstallFlags = [ "--ignore-installed" ];
|
||||
|
||||
checkInputs = [ mock scripttest virtualenv pretend pytest ];
|
||||
# Pip wants pytest, but tests are not distributed
|
||||
doCheck = false;
|
||||
|
||||
meta = {
|
||||
description = "The PyPA recommended tool for installing Python packages";
|
||||
license = with lib.licenses; [ mit ];
|
||||
homepage = "https://pip.pypa.io/";
|
||||
priority = 10;
|
||||
};
|
||||
}
|
@ -22,7 +22,10 @@ let
|
||||
|
||||
namePrefix = python.libPrefix + "-";
|
||||
|
||||
bootstrapped-pip = callPackage ../development/python-modules/bootstrapped-pip { };
|
||||
bootstrapped-pip = if isPy3k then
|
||||
callPackage ../development/python-modules/bootstrapped-pip { }
|
||||
else
|
||||
callPackage ../development/python-modules/bootstrapped-pip/2.nix { };
|
||||
|
||||
# Derivations built with `buildPythonPackage` can already be overriden with `override`, `overrideAttrs`, and `overrideDerivation`.
|
||||
# This function introduces `overridePythonAttrs` and it overrides the call to `buildPythonPackage`.
|
||||
@ -5122,7 +5125,10 @@ in {
|
||||
|
||||
pint = callPackage ../development/python-modules/pint { };
|
||||
|
||||
pip = callPackage ../development/python-modules/pip { };
|
||||
pip = if isPy3k then
|
||||
callPackage ../development/python-modules/pip { }
|
||||
else
|
||||
callPackage ../development/python-modules/pip/20.nix { };
|
||||
|
||||
pipdate = callPackage ../development/python-modules/pipdate { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user