GNU bug report logs - #74806
[WIP PATCH] gnu: python-mathics-core: Add docs.

Previous Next

Package: guix-patches;

Reported by: Danny Milosavljevic <dannym <at> friendly-machines.com>

Date: Thu, 12 Dec 2024 00:18:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 74806 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to andreas <at> enge.fr, bavier <at> posteo.net, sharlatanus <at> gmail.com, guix-patches <at> gnu.org:
bug#74806; Package guix-patches. (Thu, 12 Dec 2024 00:18:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Danny Milosavljevic <dannym <at> friendly-machines.com>:
New bug report received and forwarded. Copy sent to andreas <at> enge.fr, bavier <at> posteo.net, sharlatanus <at> gmail.com, guix-patches <at> gnu.org. (Thu, 12 Dec 2024 00:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> friendly-machines.com>
To: guix-patches <at> gnu.org
Cc: Danny Milosavljevic <dannym <at> friendly-machines.com>
Subject: [WIP PATCH] gnu: python-mathics-core: Add docs.
Date: Thu, 12 Dec 2024 01:08:54 +0100
I would like help fixing a build failure here (latexmk parallelism problem):

! Undefined control sequence.
l.289 \InputIfFile

./source/mathics/doc/latex/mathics.pre:

  \InputIfFileExists {\jobname -281.pre}{}{}
  \InputIfFileExists {\jobname -282.pre}{}{}
  \InputIfFileExists {\jobname -283.pre}{}{}
  \InputIfFileExists {\jobname -284.pre}{}{}
  \InputIfFileExists {\jobname -285.pre}{}{}
  \InputIfFileExists {\jobname -286.pre}{}{}
  \InputIfFileExists {\jobname -287.pre}{}{}
  \InputIfFileExists {\jobname -288.pre}{}{}
  \InputIfFile

(ed note: Cut off in the original)

* gnu/packages/plotutils.scm (asymptote): Install files where latex will find them.
* gnu/packages/maths.scm (python-mathics-core): Add docs.

Change-Id: Id2dac5f9b4b3bdcfbb751a94263261fb69edb461
---
 gnu/packages/maths.scm     | 57 +++++++++++++++++++++++++++++++++++---
 gnu/packages/plotutils.scm |  4 +--
 2 files changed, 55 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 60203f82a9..ec2e43c737 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -124,13 +124,14 @@ (define-module (gnu packages maths)
   #:use-module (gnu packages cpp)
   #:use-module (gnu packages datamash)
   #:use-module (gnu packages dbm)
-  #:use-module (gnu packages documentation)
   #:use-module (gnu packages django)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages emacs)
   #:use-module (gnu packages file)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fltk)
+  #:use-module (gnu packages fonts)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gettext)
@@ -152,6 +153,7 @@ (define-module (gnu packages maths)
   #:use-module (gnu packages llvm)
   #:use-module (gnu packages logging)
   #:use-module (gnu packages lua)
+  #:use-module (gnu packages plotutils)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages xorg)
@@ -10537,6 +10539,7 @@ (define-public python-mathics-core
               (sha256
                (base32
                 "0hhk2qq6swnprf9hliazwi3858sv3b3015g0mnm4ycdk5fsc7y57"))))
+    (outputs '("out" "doc"))
     (arguments
      `(;; <https://github.com/pytest-dev/pytest/pull/10173> is missing .closed
        #:test-flags '("-s")
@@ -10544,6 +10547,11 @@ (define-public python-mathics-core
        (modify-phases %standard-phases
          (add-after 'unpack 'patch-bugs
            (lambda _
+             (substitute* "mathics/doc/latex_doc.py"
+              (("^NUMBER_RE = .*")
+               ;; Prevent a match of "-7.0.0" (version number)
+               ; X"NUMBER_RE = re.compile(r\"([ -])(\d*(?<!\.)\.\d+|\d+\.(?!\.)\d*|\d+)(?![.0123456789])\")\n"
+               "NUMBER_RE = re.compile(r\"([ -])(\\d*(?<!\\.)\\.\\d+|\\d+\\.(?!\\.)\\d*|\\d+)(?![.0123456789])\")\n"))
              (substitute* "pyproject.toml"
               (("\"autoload/\\*.m\",")
                ;; They forgot to install autoload/rules/*.m
@@ -10551,15 +10559,56 @@ (define-public python-mathics-core
              ;; Prevent internet access by tests.
              (substitute* "mathics/builtin/files_io/files.py"
               (("https://raw.githubusercontent.com/Mathics3/mathics-core/master/README.rst")
-               (string-append (getcwd) "/README.rst")))))
+               (string-append (getcwd) "/README.rst")))
+             (substitute* "mathics/docpipeline.py"
+              ;; Undefined.
+              (("test_parameters[.]doc_even_if_error") "False"))))
+         ;; TODO: make latexdoc ; (cd mathics/doc/latex && $(MAKE) doc)
+         (add-after 'install 'build-docs
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ; Would fuck up LOCAL_ROOT_DIR: (add-installed-pythonpath inputs outputs)
+             (setenv "PYTHONPATH" (getcwd))
+             (substitute* "mathics/settings.py"
+               (("^(ROOT_DIR = .*)" _ a) (string-append a "\nimport sys\nprint('XXROOT_DIR', ROOT_DIR, sys.stderr)\n")))
+             (setenv "HOME" "/tmp")
+             (mkdir-p "/tmp/.local/var/mathics")
+             (setenv "BASH" (which "bash"))
+             (invoke "make" "latexdoc")
+             ;; TODO: The other files.
+             (install-file "mathics/doc/latex/mathics-title.pdf"
+              (string-append (assoc-ref outputs "doc") "/share/doc/mathics"))))
          (add-before 'check 'prepare-locales
            (lambda _
              ;; Otherwise 210 tests fail because the real output would use
              ;; unicode arrow characters.  With this, only 18 (symbolic) tests fail.
              (setenv "MATHICS_CHARACTER_ENCODING" "ASCII"))))))
     (build-system pyproject-build-system)
-    (native-inputs (list python-pytest))
-    (inputs (list llvm))
+    (native-inputs (list python-pytest
+                         texlive-xetex
+                         font-latin-modern
+                         (texlive-updmap.cfg
+                          (list asymptote
+                                texlive-latexmk
+                                texlive-koma-script
+                                texlive-gensymb
+                                texlive-newpx
+                                texlive-xstring
+                                texlive-kastrup
+                                texlive-preprint
+                                texlive-listings
+                                texlive-paralist
+                                texlive-breqn
+                                texlive-environ
+                                texlive-colophon
+                                texlive-minitoc
+                                texlive-mlmodern
+                                texlive-palatino
+                                texlive-mathpazo
+                                texlive-pagella-otf
+                                texlive-tex-gyre-math))
+                         ghostscript
+                         bash))
+    (inputs (list llvm asymptote))
     (propagated-inputs (list python-mpmath
                              python-pint
                              python-palettable
diff --git a/gnu/packages/plotutils.scm b/gnu/packages/plotutils.scm
index d5b2f0d9fa..72faa6c31f 100644
--- a/gnu/packages/plotutils.scm
+++ b/gnu/packages/plotutils.scm
@@ -136,10 +136,10 @@ (define-public asymptote
                            (guix build emacs-utils))
       #:configure-flags
       #~(list (string-append "--enable-gc=" #$(this-package-input "libgc"))
-              (string-append "--with-latex=" #$output "/share/texmf/tex/latex")
+              (string-append "--with-latex=" #$output "/share/texmf-dist/tex/latex")
               (string-append "--with-context="
                              #$output
-                             "/share/texmf/tex/context/third"))
+                             "/share/texmf-dist/tex/context/third"))
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'locate-tirpc

base-commit: 8b65fdc182e7340946be8b1e7b688d03b96c3482
-- 
2.46.0





Information forwarded to guix-patches <at> gnu.org:
bug#74806; Package guix-patches. (Wed, 22 Jan 2025 10:58:02 GMT) Full text and rfc822 format available.

Message #8 received at 74806 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Enge <andreas <at> enge.fr>
To: Danny Milosavljevic <dannym <at> friendly-machines.com>
Cc: 74806 <at> debbugs.gnu.org, Sharlatan Hellseher <sharlatanus <at> gmail.com>,
 Eric Bavier <bavier <at> posteo.net>
Subject: Re: [bug#74806] [WIP PATCH] gnu: python-mathics-core: Add docs.
Date: Wed, 22 Jan 2025 11:57:45 +0100
Hello Danny,

I tried to apply your patch, but cannot do it; probably the package was
updated during a recent python team cycle. Then I had a try at running
directly "pdflatex mathics.tex", but since this is missing autogenerated
filed I did not get any further.

Am Thu, Dec 12, 2024 at 01:08:54AM +0100 schrieb Danny Milosavljevic:
> ./source/mathics/doc/latex/mathics.pre:
>   \InputIfFileExists {\jobname -281.pre}{}{}

The space in the file name is suspicious. My guess is that this breaks
TeX parsing.

Andreas





This bug report was last modified 144 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.