2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
installShellFiles,
|
|
|
|
mock,
|
|
|
|
scripttest,
|
|
|
|
setuptools,
|
|
|
|
virtualenv,
|
|
|
|
wheel,
|
|
|
|
pretend,
|
|
|
|
pytest,
|
|
|
|
|
|
|
|
# docs
|
|
|
|
sphinx,
|
|
|
|
|
|
|
|
# coupled downsteam dependencies
|
|
|
|
pip-tools,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pip";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "24.0";
|
2023-10-09 19:29:22 +00:00
|
|
|
format = "pyproject";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pypa";
|
|
|
|
repo = pname;
|
2023-01-20 10:41:00 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-yojk2T5wuPkS1OKusilj253AT+xyKwXCWKBNUEH2Mgo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Remove vendored Windows PE binaries
|
|
|
|
# Note: These are unused but make the package unreproducible.
|
|
|
|
find -type f -name '*.exe' -delete
|
|
|
|
'';
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
setuptools
|
|
|
|
wheel
|
|
|
|
|
|
|
|
# docs
|
|
|
|
sphinx
|
|
|
|
];
|
|
|
|
|
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"man"
|
|
|
|
];
|
|
|
|
|
|
|
|
# pip uses a custom sphinx extension and unusual conf.py location, mimic the internal build rather than attempting
|
|
|
|
# to fit sphinxHook see https://github.com/pypa/pip/blob/0778c1c153da7da457b56df55fb77cbba08dfb0c/noxfile.py#L129-L148
|
|
|
|
postBuild = ''
|
|
|
|
cd docs
|
|
|
|
|
|
|
|
# remove references to sphinx extentions only required for html doc generation
|
|
|
|
# sphinx.ext.intersphinx requires network connection or packaged object.inv files for python and pypug
|
|
|
|
# sphinxcontrib.towncrier is not currently packaged
|
|
|
|
for ext in sphinx.ext.intersphinx sphinx_copybutton sphinx_inline_tabs sphinxcontrib.towncrier myst_parser; do
|
|
|
|
substituteInPlace html/conf.py --replace '"'$ext'",' ""
|
|
|
|
done
|
|
|
|
|
|
|
|
PYTHONPATH=$src/src:$PYTHONPATH sphinx-build -v \
|
|
|
|
-d build/doctrees/man \
|
|
|
|
-c html \
|
|
|
|
-d build/doctrees/man \
|
|
|
|
-b man \
|
|
|
|
man \
|
|
|
|
build/man
|
|
|
|
cd ..
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
mock
|
|
|
|
scripttest
|
|
|
|
virtualenv
|
|
|
|
pretend
|
|
|
|
pytest
|
|
|
|
];
|
2023-10-09 19:29:22 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# Pip wants pytest, but tests are not distributed
|
|
|
|
doCheck = false;
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
postInstall = ''
|
|
|
|
installManPage docs/build/man/*
|
|
|
|
|
|
|
|
installShellCompletion --cmd pip \
|
|
|
|
--bash <($out/bin/pip completion --bash --no-cache-dir) \
|
|
|
|
--fish <($out/bin/pip completion --fish --no-cache-dir) \
|
|
|
|
--zsh <($out/bin/pip completion --zsh --no-cache-dir)
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit pip-tools;
|
|
|
|
};
|
2022-01-23 02:10:13 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
description = "The PyPA recommended tool for installing Python packages";
|
|
|
|
license = with lib.licenses; [ mit ];
|
|
|
|
homepage = "https://pip.pypa.io/";
|
2023-03-15 16:39:30 +00:00
|
|
|
changelog = "https://pip.pypa.io/en/stable/news/#v${lib.replaceStrings [ "." ] [ "-" ] version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|