summary refs log tree commit diff
diff options
context:
space:
mode:
authorDmitry Bogatov <serenity@kaction.cc>2023-01-05 21:35:51 -0500
committerYt <happysalada@proton.me>2023-01-15 16:16:55 -0500
commit35a4ca4bde5aca6d29fc2c24704cb355f4fe95f5 (patch)
treea9433ad656250180dae0e97bc9c7df68692aabf2
parentc29db3b9fbf3753e71b86d896ee85adb0df642c1 (diff)
downloadnixpkgs-35a4ca4bde5aca6d29fc2c24704cb355f4fe95f5.tar
nixpkgs-35a4ca4bde5aca6d29fc2c24704cb355f4fe95f5.tar.gz
nixpkgs-35a4ca4bde5aca6d29fc2c24704cb355f4fe95f5.tar.bz2
nixpkgs-35a4ca4bde5aca6d29fc2c24704cb355f4fe95f5.tar.lz
nixpkgs-35a4ca4bde5aca6d29fc2c24704cb355f4fe95f5.tar.xz
nixpkgs-35a4ca4bde5aca6d29fc2c24704cb355f4fe95f5.tar.zst
nixpkgs-35a4ca4bde5aca6d29fc2c24704cb355f4fe95f5.zip
python3.pkgs.hypothesis: build offline documentation
-rw-r--r--pkgs/development/python-modules/chardet/default.nix3
-rw-r--r--pkgs/development/python-modules/cryptography/default.nix3
-rw-r--r--pkgs/development/python-modules/hypothesis/default.nix27
-rw-r--r--pkgs/development/python-modules/iso8601/default.nix3
-rw-r--r--pkgs/development/python-modules/numpy/default.nix3
-rw-r--r--pkgs/development/python-modules/twisted/default.nix3
6 files changed, 37 insertions, 5 deletions
diff --git a/pkgs/development/python-modules/chardet/default.nix b/pkgs/development/python-modules/chardet/default.nix
index 07a0cbccf25..7a183f5ec88 100644
--- a/pkgs/development/python-modules/chardet/default.nix
+++ b/pkgs/development/python-modules/chardet/default.nix
@@ -23,7 +23,8 @@ buildPythonPackage rec {
   ];
 
   checkInputs = [
-    hypothesis
+    # "hypothesis" indirectly depends on chardet to build its documentation.
+    (hypothesis.override { enableDocumentation = false; })
     pytestCheckHook
   ];
 
diff --git a/pkgs/development/python-modules/cryptography/default.nix b/pkgs/development/python-modules/cryptography/default.nix
index 7f746655c76..4a539b58dec 100644
--- a/pkgs/development/python-modules/cryptography/default.nix
+++ b/pkgs/development/python-modules/cryptography/default.nix
@@ -62,7 +62,8 @@ buildPythonPackage rec {
 
   checkInputs = [
     cryptography-vectors
-    hypothesis
+    # "hypothesis" indirectly depends on cryptography to build its documentation
+    (hypothesis.override { enableDocumentation = false; })
     iso8601
     pretend
     py
diff --git a/pkgs/development/python-modules/hypothesis/default.nix b/pkgs/development/python-modules/hypothesis/default.nix
index dd6784335f2..af21b7ceeb5 100644
--- a/pkgs/development/python-modules/hypothesis/default.nix
+++ b/pkgs/development/python-modules/hypothesis/default.nix
@@ -9,11 +9,18 @@
 , pytest-xdist
 , sortedcontainers
 , pythonOlder
+, sphinxHook
+, sphinx-rtd-theme
+, sphinx-hoverxref
+, sphinx-codeautolink
+# Used to break internal dependency loop.
+, enableDocumentation ? true
 }:
 
 buildPythonPackage rec {
   pname = "hypothesis";
   version = "6.61.0";
+  outputs = [ "out" ] ++ lib.optional enableDocumentation "doc";
   format = "setuptools";
 
   disabled = pythonOlder "3.7";
@@ -25,8 +32,28 @@ buildPythonPackage rec {
     hash = "sha256-gTcdJaOgP8Nc4fN8UH6+sLedivq5ZNxMRULajFOVnSo=";
   };
 
+  # I tried to package sphinx-selective-exclude, but it throws
+  # error about "module 'sphinx' has no attribute 'directives'".
+  #
+  # It probably has to do with monkey-patching internals of Sphinx.
+  # On bright side, this extension does not introduces new commands,
+  # only changes "::only" command, so we probably okay with stock
+  # implementation.
+  #
+  # I wonder how upstream of "hypothesis" builds documentation.
+  postPatch = ''
+    sed -i -e '/sphinx_selective_exclude.eager_only/ d' docs/conf.py
+  '';
+
   postUnpack = "sourceRoot=$sourceRoot/hypothesis-python";
 
+  nativeBuildInputs = lib.optionals enableDocumentation [
+    sphinxHook
+    sphinx-rtd-theme
+    sphinx-hoverxref
+    sphinx-codeautolink
+  ];
+
   propagatedBuildInputs = [
     attrs
     sortedcontainers
diff --git a/pkgs/development/python-modules/iso8601/default.nix b/pkgs/development/python-modules/iso8601/default.nix
index e189e3778bc..d2e1d121ee8 100644
--- a/pkgs/development/python-modules/iso8601/default.nix
+++ b/pkgs/development/python-modules/iso8601/default.nix
@@ -25,7 +25,8 @@ buildPythonPackage rec {
   ];
 
   checkInputs = [
-    hypothesis
+    # "hypothesis" indirectly depends on iso8601 to build its documentation
+    (hypothesis.override { enableDocumentation = false; })
     pytestCheckHook
     pytz
   ];
diff --git a/pkgs/development/python-modules/numpy/default.nix b/pkgs/development/python-modules/numpy/default.nix
index 3a73b1bf3d5..9b420354055 100644
--- a/pkgs/development/python-modules/numpy/default.nix
+++ b/pkgs/development/python-modules/numpy/default.nix
@@ -77,7 +77,8 @@ in buildPythonPackage rec {
 
   checkInputs = [
     pytest
-    hypothesis
+    # "hypothesis" indirectly depends on numpy to build its documentation.
+    (hypothesis.override { enableDocumentation = false; })
     typing-extensions
   ];
 
diff --git a/pkgs/development/python-modules/twisted/default.nix b/pkgs/development/python-modules/twisted/default.nix
index f90cdeec51c..2a847e9262d 100644
--- a/pkgs/development/python-modules/twisted/default.nix
+++ b/pkgs/development/python-modules/twisted/default.nix
@@ -132,7 +132,8 @@ buildPythonPackage rec {
   checkInputs = [
     git
     glibcLocales
-    hypothesis
+    # "hypothesis" indirectly depends on twisted to build its documentation.
+    (hypothesis.override { enableDocumentation = false; })
     pyhamcrest
   ]
   ++ passthru.optional-dependencies.conch