about summary refs log tree commit diff
path: root/pkgs/development/python-modules/hypothesis/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/hypothesis/default.nix')
-rw-r--r--pkgs/development/python-modules/hypothesis/default.nix39
1 files changed, 28 insertions, 11 deletions
diff --git a/pkgs/development/python-modules/hypothesis/default.nix b/pkgs/development/python-modules/hypothesis/default.nix
index bfa2ca0dc87e8..fab840a74e992 100644
--- a/pkgs/development/python-modules/hypothesis/default.nix
+++ b/pkgs/development/python-modules/hypothesis/default.nix
@@ -8,21 +8,21 @@
 , doCheck ? true
 , pytestCheckHook
 , pytest-xdist
+, python
 , sortedcontainers
+, stdenv
 , pythonOlder
 , sphinxHook
 , sphinx-rtd-theme
 , sphinx-hoverxref
 , sphinx-codeautolink
 , tzdata
-# Used to break internal dependency loop.
-, enableDocumentation ? true
 }:
 
 buildPythonPackage rec {
   pname = "hypothesis";
   version = "6.68.2";
-  outputs = [ "out" ] ++ lib.optional enableDocumentation "doc";
+  outputs = [ "out" ];
   format = "setuptools";
 
   disabled = pythonOlder "3.7";
@@ -49,13 +49,6 @@ buildPythonPackage rec {
 
   postUnpack = "sourceRoot=$sourceRoot/hypothesis-python";
 
-  nativeBuildInputs = lib.optionals enableDocumentation [
-    sphinxHook
-    sphinx-rtd-theme
-    sphinx-hoverxref
-    sphinx-codeautolink
-  ];
-
   propagatedBuildInputs = [
     attrs
     sortedcontainers
@@ -67,7 +60,7 @@ buildPythonPackage rec {
     pexpect
     pytest-xdist
     pytestCheckHook
-  ] ++ lib.optionals (isPyPy) [
+  ] ++ lib.optionals isPyPy [
     tzdata
   ];
 
@@ -86,6 +79,30 @@ buildPythonPackage rec {
     "hypothesis"
   ];
 
+  passthru = {
+    doc = stdenv.mkDerivation {
+      # Forge look and feel of multi-output derivation as best as we can.
+      #
+      # Using 'outputs = [ "doc" ];' breaks a lot of assumptions.
+      name = "${pname}-${version}-doc";
+      inherit src pname version;
+
+      postInstallSphinx = ''
+        mv $out/share/doc/* $out/share/doc/python$pythonVersion-$pname-$version
+      '';
+
+      nativeBuildInputs = [
+        sphinxHook
+        sphinx-rtd-theme
+        sphinx-hoverxref
+        sphinx-codeautolink
+      ];
+
+      inherit (python) pythonVersion;
+      inherit meta;
+    };
+  };
+
   meta = with lib; {
     description = "Library for property based testing";
     homepage = "https://github.com/HypothesisWorks/hypothesis";