summary refs log tree commit diff
diff options
context:
space:
mode:
authorAnund <anundm@gmail.com>2023-08-21 21:05:51 -0600
committerAnund <anundm@gmail.com>2023-08-22 10:38:19 -0600
commit30b6520d9e5486d19af0143d91008807435eab4b (patch)
tree3d18400e77023e8f99874ac4882aff250f507aa6
parent1f6fb14d170e9e25a2ccdf84514bf144ce2b8d52 (diff)
downloadnixpkgs-30b6520d9e5486d19af0143d91008807435eab4b.tar
nixpkgs-30b6520d9e5486d19af0143d91008807435eab4b.tar.gz
nixpkgs-30b6520d9e5486d19af0143d91008807435eab4b.tar.bz2
nixpkgs-30b6520d9e5486d19af0143d91008807435eab4b.tar.lz
nixpkgs-30b6520d9e5486d19af0143d91008807435eab4b.tar.xz
nixpkgs-30b6520d9e5486d19af0143d91008807435eab4b.tar.zst
nixpkgs-30b6520d9e5486d19af0143d91008807435eab4b.zip
python3.pkgs.pip: install man pages
-rw-r--r--pkgs/development/python-modules/pip/default.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/pip/default.nix b/pkgs/development/python-modules/pip/default.nix
index bc06cb39e24..01cdb5f6273 100644
--- a/pkgs/development/python-modules/pip/default.nix
+++ b/pkgs/development/python-modules/pip/default.nix
@@ -10,6 +10,9 @@
 , pretend
 , pytest
 
+# docs
+, sphinx
+
 # coupled downsteam dependencies
 , pip-tools
 }:
@@ -36,14 +39,46 @@ buildPythonPackage rec {
     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 ..
+  '';
+
   nativeCheckInputs = [ mock scripttest virtualenv pretend pytest ];
 
   # Pip wants pytest, but tests are not distributed
   doCheck = false;
 
   postInstall = ''
+    installManPage docs/build/man/*
+
     installShellCompletion --cmd pip \
       --bash <($out/bin/pip completion --bash) \
       --fish <($out/bin/pip completion --fish) \