summary refs log tree commit diff
path: root/gnu/packages/python-xyz.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-04-16 23:44:01 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-05-12 12:45:49 -0400
commit2576d9ffc4c5cf84c4c6c1dfee2d2d8655fba4b4 (patch)
treeb02a2d75f95e44173d9aa2fb807bb79471e7c8ac /gnu/packages/python-xyz.scm
parent5fdae311a0a5beaff5f048001f56ff0fa7d05e4c (diff)
downloadguix-2576d9ffc4c5cf84c4c6c1dfee2d2d8655fba4b4.tar.gz
gnu: python-ipython-documentation: Also build info and pdf targets.
* gnu/packages/patches/python-ipython-documentation-chars.patch: New file.
* gnu/packages/patches/python-ipython-documentation-repro.patch: Likewise.
* gnu/local.mk: Register them.
* gnu/packages/python-xyz.scm (python-ipython-documentation)
[source]: Apply patches.
[arguments]: Use gexps.
[phases]{sanitize-sources}: New phase.
{configure-sphinx-for-xelatex}: Likewise.
{install}: Streamline.  Also build and install the PDF and info manual.
Enable parallel processing.
[inputs]: Delete field.
[propagated-inputs]: Remove texlive-updmap.cfg input.  Add fontconfig,
font-gnu-freefont, graphviz, python-docrepr, texlive-polyglossia,
texlive-bin and texlive-xindy.
Diffstat (limited to 'gnu/packages/python-xyz.scm')
-rw-r--r--gnu/packages/python-xyz.scm145
1 files changed, 73 insertions, 72 deletions
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 23bf8add15..78e5334bce 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -155,9 +155,11 @@
   #:use-module (gnu packages django)
   #:use-module (gnu packages djvu)
   #:use-module (gnu packages docker)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages enchant)
   #:use-module (gnu packages file)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages fonts)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gdb)
   #:use-module (gnu packages gcc)
@@ -9389,79 +9391,78 @@ computing.")
     (inherit python-ipython)
     (name "python-ipython-documentation")
     (version (package-version python-ipython))
+    (source
+     (origin
+       (inherit (package-source python-ipython))
+       (patches (append (search-patches
+                         "python-ipython-documentation-chars.patch"
+                         "python-ipython-documentation-repro.patch")
+                        (origin-patches (package-source python-ipython))))))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (delete 'build)
-         (delete 'check)
-         (replace 'install
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((data (string-append (assoc-ref outputs "out") "/share"))
-                    (doc (string-append data "/doc/" ,name "-" ,version))
-                    (html (string-append doc "/html"))
-                    (man1 (string-append data "/man/man1"))
-                    (info (string-append data "/info"))
-                    (examples (string-append doc "/examples"))
-                    (python-arg (string-append "PYTHON=" (which "python"))))
-               (setenv "LANG" "en_US.utf8")
-               (with-directory-excursion "docs"
-                 ;; FIXME: pdf fails to build
-                 ;;(system* "make" "pdf" "PAPER=a4")
-                 (system* "make" python-arg "html")
-                 ;; FIXME: the generated texi file contains ^@^@, which trips
-                 ;; up the parser.
-                 ;; (system* "make" python-arg "info")
-                 )
-               (copy-recursively "docs/man" man1)
-               (copy-recursively "examples" examples)
-               (copy-recursively "docs/build/html" html)
-               ;; (copy-file "docs/build/latex/ipython.pdf"
-               ;;            (string-append doc "/ipython.pdf"))
-               (mkdir-p info)
-               ;; (copy-file "docs/build/texinfo/ipython.info"
-               ;;            (string-append info "/ipython.info"))
-               (copy-file "COPYING.rst" (string-append doc "/COPYING.rst"))))))))
-    (inputs
-     (list python-ipython python-ipykernel))
-    (native-inputs
-     `(("python-sphinx" ,python-sphinx)
-       ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
-       ;; FIXME: It's possible that a smaller updmap.cfg would work just as
-       ;; well.
-       ("texlive" ,(texlive-updmap.cfg (list texlive-amsfonts
-                                        texlive-capt-of
-                                        texlive-fonts-ec
-                                        texlive-generic-iftex
-                                        texlive-pdftex
-                                        texlive-latex-cmap
-                                        texlive-latex-environ
-                                        texlive-latex-eqparbox
-                                        texlive-etoolbox
-                                        texlive-latex-expdlist
-                                        texlive-latex-fancyhdr
-                                        texlive-latex-fancyvrb
-                                        texlive-latex-fncychap
-                                        texlive-latex-float
-                                        texlive-latex-framed
-                                        texlive-latex-geometry
-                                        texlive-latex-graphics
-                                        texlive-hyperref
-                                        texlive-latex-mdwtools
-                                        texlive-latex-multirow
-                                        texlive-latex-needspace
-                                        texlive-oberdiek
-                                        texlive-latex-parskip
-                                        texlive-latex-preview
-                                        texlive-latex-tabulary
-                                        texlive-latex-threeparttable
-                                        texlive-latex-titlesec
-                                        texlive-latex-trimspaces
-                                        texlive-latex-ucs
-                                        texlive-latex-upquote
-                                        texlive-url
-                                        texlive-latex-varwidth
-                                        texlive-wrapfig)))
-       ("texinfo" ,texinfo)))))
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'set-pythonpath
+            (lambda _
+              ;; Ensure this fixed (via the
+              ;; "python-ipython-documentation-chars.patch" patch) copy of
+              ;; IPython gets used.
+              (setenv "PYTHONPATH" (string-append (getcwd)))))
+          (add-before 'build 'configure-sphinx-for-xelatex
+            (lambda _
+              ;; Use XeLaTeX instead of PDFLaTeX, as it can
+              ;; cope with the Unicode characters present in the
+              ;; contributors page, for example.
+              (substitute* "docs/source/conf.py"
+                (("project = 'IPython'.*" all)
+                 (string-append all "latex_engine = 'xelatex'\n")))
+              ;; XXX: The Sphinx-generated ipython.tex specifies the GNU
+              ;; FreeFont font to be searched via its extension, which uses
+              ;; kpathsea instead of fontconfig and fail (see:
+              ;; https://github.com/sphinx-doc/sphinx/issues/10347).  Create a
+              ;; symlink to GNU FreeFont and add it to the TEXMF tree via
+              ;; GUIX_TEXMF.
+              (mkdir-p "texmf-dist/fonts/opentype/public")
+              (symlink (string-append
+                        #$(this-package-native-input "font-gnu-freefont")
+                        "/share/fonts/opentype")
+                       (string-append
+                        (getcwd) "/"
+                        "texmf-dist/fonts/opentype/public/gnu-freefont"))
+              (setenv "GUIX_TEXMF" (string-append (getenv "GUIX_TEXMF") ":"
+                                                  (getcwd) "/texmf-dist"))))
+          (delete 'build)
+          (delete 'check)
+          (replace 'install
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((data (string-append #$output "/share"))
+                     (doc (string-append data "/doc/" #$name "-" #$version))
+                     (html (string-append doc "/html"))
+                     (info (string-append data "/info")))
+                (invoke "make" "-C" "docs" "info" "html" "pdf"
+                        (string-append "SPHINXOPTS=-j"
+                                       (number->string (parallel-job-count))))
+                (install-file "COPYING.rst" doc)
+                (copy-recursively "examples" (string-append doc "/examples"))
+                ;; Install HTML documentation.
+                (copy-recursively "docs/build/html" html)
+                ;; Likewise for the PDF.
+                (install-file "docs/build/latex/ipython.pdf" doc)
+                ;; Likewise for the info manual.
+                (install-file "docs/build/texinfo/ipython.info" info)
+                (symlink (string-append html "/_images")
+                         (string-append info "/ipython-figures"))))))))
+    (native-inputs
+     (list fontconfig                   ;for XDG_DATA_DIRS to locate fonts
+           font-gnu-freefont
+           graphviz
+           python-docrepr
+           python-sphinx
+           python-sphinx-rtd-theme
+           texinfo
+           texlive-bin
+           texlive-polyglossia
+           texlive-xindy))))
 
 (define-public python-urwid
   (package