at 24.11-pre 2.5 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 installShellFiles, 6 mock, 7 scripttest, 8 setuptools, 9 virtualenv, 10 wheel, 11 pretend, 12 pytest, 13 14 # docs 15 sphinx, 16 17 # coupled downsteam dependencies 18 pip-tools, 19}: 20 21buildPythonPackage rec { 22 pname = "pip"; 23 version = "24.0"; 24 format = "pyproject"; 25 26 src = fetchFromGitHub { 27 owner = "pypa"; 28 repo = pname; 29 rev = "refs/tags/${version}"; 30 hash = "sha256-yojk2T5wuPkS1OKusilj253AT+xyKwXCWKBNUEH2Mgo="; 31 }; 32 33 postPatch = '' 34 # Remove vendored Windows PE binaries 35 # Note: These are unused but make the package unreproducible. 36 find -type f -name '*.exe' -delete 37 ''; 38 39 nativeBuildInputs = [ 40 installShellFiles 41 setuptools 42 wheel 43 44 # docs 45 sphinx 46 ]; 47 48 outputs = [ 49 "out" 50 "man" 51 ]; 52 53 # pip uses a custom sphinx extension and unusual conf.py location, mimic the internal build rather than attempting 54 # to fit sphinxHook see https://github.com/pypa/pip/blob/0778c1c153da7da457b56df55fb77cbba08dfb0c/noxfile.py#L129-L148 55 postBuild = '' 56 cd docs 57 58 # remove references to sphinx extentions only required for html doc generation 59 # sphinx.ext.intersphinx requires network connection or packaged object.inv files for python and pypug 60 # sphinxcontrib.towncrier is not currently packaged 61 for ext in sphinx.ext.intersphinx sphinx_copybutton sphinx_inline_tabs sphinxcontrib.towncrier myst_parser; do 62 substituteInPlace html/conf.py --replace '"'$ext'",' "" 63 done 64 65 PYTHONPATH=$src/src:$PYTHONPATH sphinx-build -v \ 66 -d build/doctrees/man \ 67 -c html \ 68 -d build/doctrees/man \ 69 -b man \ 70 man \ 71 build/man 72 cd .. 73 ''; 74 75 nativeCheckInputs = [ 76 mock 77 scripttest 78 virtualenv 79 pretend 80 pytest 81 ]; 82 83 # Pip wants pytest, but tests are not distributed 84 doCheck = false; 85 86 postInstall = '' 87 installManPage docs/build/man/* 88 89 installShellCompletion --cmd pip \ 90 --bash <($out/bin/pip completion --bash --no-cache-dir) \ 91 --fish <($out/bin/pip completion --fish --no-cache-dir) \ 92 --zsh <($out/bin/pip completion --zsh --no-cache-dir) 93 ''; 94 95 passthru.tests = { 96 inherit pip-tools; 97 }; 98 99 meta = { 100 description = "The PyPA recommended tool for installing Python packages"; 101 license = with lib.licenses; [ mit ]; 102 homepage = "https://pip.pypa.io/"; 103 changelog = "https://pip.pypa.io/en/stable/news/#v${lib.replaceStrings [ "." ] [ "-" ] version}"; 104 }; 105}