[bug#54571] gnu: music21: Patch executables and add missing dependencies.

Message ID 20220326011233.25118-1-jgart@dismail.de
State New
Headers
Series [bug#54571] gnu: music21: Patch executables and add missing dependencies. |

Commit Message

jgart March 26, 2022, 1:12 a.m. UTC
* gnu/packages/music.scm (music21)[arguments]: Patch executables.
[propagated-inputs]: Add python-matplotlib, python-jsonpickle, and
python-numpy.
[inputs]: Add lilypond, musescore, and xdg-utils.
---
 gnu/packages/music.scm | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
  

Comments

Maxime Devos March 26, 2022, 9:33 a.m. UTC | #1
jgart via Guix-patches via schreef op vr 25-03-2022 om 21:12 [-0400]:
> +               (("/usr/bin/lilypond") (which "lilypond"))
> +               (("/usr/bin/mscore3") (which "mscore"))
> +               (("/usr/bin/xdg-open") (which "xdg-open"))
> +               (("LILYEXEC = 'lilypond'")
> +                (string-append "LILYEXEC = '" (which "lilypond") "'")))))
> [...]
> +    (inputs
> +      (list lilypond
> +            musescore
> +            xdg-utils))

'which' looks in native-inputs, not the 'inputs', so this is probably
incorrect when cross-compiling.  I suggest using (search-input-file
inputs "/bin/lilypond") instead.

Greetings,
Maxime.
  
Maxime Devos March 26, 2022, 9:34 a.m. UTC | #2
jgart via Guix-patches via schreef op vr 25-03-2022 om 21:12 [-0400]:
>      (propagated-inputs
> -      (list python-chardet python-joblib python-more-itertools
> -            python-webcolors))
> +      (list python-chardet
> +            python-joblib
> +            python-matplotlib
> +            python-jsonpickle
> +            python-more-itertools
> +            python-webcolors
> +            python-numpy))

It is a tool, and not (only?) a library, so do these need to be
propagated, or would some wrapping suffice?

Greetings,
Maxime.
  

Patch

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index 9c8203aa80..2c6b530aac 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -1531,6 +1531,15 @@  (define-public music21
     (arguments
      `(#:phases
        (modify-phases %standard-phases
+         (add-before 'build 'patch-executables
+           (lambda _
+             (substitute* '("music21/environment.py"
+                            "music21/lily/translate.py")
+               (("/usr/bin/lilypond") (which "lilypond"))
+               (("/usr/bin/mscore3") (which "mscore"))
+               (("/usr/bin/xdg-open") (which "xdg-open"))
+               (("LILYEXEC = 'lilypond'")
+                (string-append "LILYEXEC = '" (which "lilypond") "'")))))
          (replace 'check
            (lambda* (#:key tests? inputs outputs #:allow-other-keys)
              (when tests?
@@ -1538,8 +1547,17 @@  (define-public music21
                ;; See: https://github.com/cuthbertLab/music21/issues/1164
                (invoke "python" "-m" "music21.stream.tests")))))))
     (propagated-inputs
-      (list python-chardet python-joblib python-more-itertools
-            python-webcolors))
+      (list python-chardet
+            python-joblib
+            python-matplotlib
+            python-jsonpickle
+            python-more-itertools
+            python-webcolors
+            python-numpy))
+    (inputs
+      (list lilypond
+            musescore
+            xdg-utils))
     (home-page "https://web.mit.edu/music21/")
     (synopsis "Toolkit for Computational Musicology")
     (description