diff options
author | Dmitry Bogatov <serenity@kaction.cc> | 2023-05-06 21:56:59 -0400 |
---|---|---|
committer | Frederik Rietdijk <freddyrietdijk@fridh.nl> | 2023-06-03 16:43:46 +0200 |
commit | 2f181d6f062e6bd0b794e7978a1ec56188be95bb (patch) | |
tree | 971d27b5db39505b1484afa1448fd8cc27fda302 /pkgs/development/interpreters/python | |
parent | b15a887b59066953745fb10fc776d17bd361841a (diff) | |
download | nixpkgs-2f181d6f062e6bd0b794e7978a1ec56188be95bb.tar nixpkgs-2f181d6f062e6bd0b794e7978a1ec56188be95bb.tar.gz nixpkgs-2f181d6f062e6bd0b794e7978a1ec56188be95bb.tar.bz2 nixpkgs-2f181d6f062e6bd0b794e7978a1ec56188be95bb.tar.lz nixpkgs-2f181d6f062e6bd0b794e7978a1ec56188be95bb.tar.xz nixpkgs-2f181d6f062e6bd0b794e7978a1ec56188be95bb.tar.zst nixpkgs-2f181d6f062e6bd0b794e7978a1ec56188be95bb.zip |
python3.doc: build offline documentation
Since python documentation requires Sphinx to build, documentation is built in separate derivation to avoid hard recursion/bootstrapping questions and plugged into main derivation. Care is taken that "python3.doc" derivation feels and looks as close as possible to as if it were main derivation were multi-output one. This change does not cause rebuild of python3 itself.
Diffstat (limited to 'pkgs/development/interpreters/python')
-rw-r--r-- | pkgs/development/interpreters/python/cpython/default.nix | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index a089dbf2002..d1e541891ec 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -141,6 +141,11 @@ let "$out/bin/python" else pythonForBuild.interpreter; + src = fetchurl { + url = with sourceVersion; "https://www.python.org/ftp/python/${major}.${minor}.${patch}/Python-${version}.tar.xz"; + inherit hash; + }; + # The CPython interpreter contains a _sysconfigdata_<platform specific suffix> # module that is imported by the sysconfig and distutils.sysconfig modules. # The sysconfigdata module is generated at build time and contains settings @@ -216,15 +221,11 @@ let in with passthru; stdenv.mkDerivation { pname = "python3"; - inherit version; + inherit src version; inherit nativeBuildInputs; buildInputs = [ bash ] ++ buildInputs; # bash is only for patchShebangs - src = fetchurl { - url = with sourceVersion; "https://www.python.org/ftp/python/${major}.${minor}.${patch}/Python-${version}.tar.xz"; - inherit hash; - }; prePatch = optionalString stdenv.isDarwin '' substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"' @@ -523,7 +524,24 @@ in with passthru; stdenv.mkDerivation { separateDebugInfo = true; - inherit passthru; + passthru = passthru // { + doc = stdenv.mkDerivation { + inherit src; + name = "python${pythonVersion}-${version}-doc"; + + dontConfigure = true; + + dontBuild = true; + + sphinxRoot = "Doc"; + + postInstallSphinx = '' + mv $out/share/doc/* $out/share/doc/python${pythonVersion}-${version} + ''; + + nativeBuildInputs = with pkgsBuildBuild.python3.pkgs; [ sphinxHook python_docs_theme ]; + }; + }; enableParallelBuilding = true; |