guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simplifications enabled by switching to 'invoke'


From: Mark H Weaver
Subject: Simplifications enabled by switching to 'invoke'
Date: Wed, 24 Jan 2018 07:06:02 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hello Kei, and other fellow Guix,

address@hidden (Kei Kebreau) writes:
> commit 0af6ffdd8d81f86a232902a54f99d4cfcd369490
> Author: Kei Kebreau <address@hidden>
> Date:   Tue Jan 23 17:44:53 2018 -0500
>
>     gnu: qscintilla: Update to 2.10.2.
>     
>     * gnu/packages/qt.scm (qscintilla, python-qscintilla, 
> python-pyqt+qscintilla):
>     Update to 2.10.2.
[...]
> @@ -1715,8 +1715,8 @@ indicators, code completion and call tips.")
>           (replace 'configure
>             (lambda* (#:key outputs configure-flags #:allow-other-keys)
>               (chdir "Python")
> -             (and (zero? (apply system* "python3" "configure.py"
> -                                configure-flags))
> +             (and (apply invoke "python3" "configure.py"
> +                         configure-flags)
>                    ;; Install to the right directory
>                    (begin
>                      (substitute* '("Makefile"

Kei, I appreciate that you took this opportunity to switch from
'system*' to 'invoke' here while doing this update.  I think it makes
sense to do this whenever we update a package.

However, it's worth noting that you missed an important further
simplification that the switch to 'invoke' enables.  Since 'invoke'
never returns #false, the surrounding code that arranges for plumbing of
its result code can be removed entirely.

Step by step:

* Since 'invoke' never returns #false, it can be moved above the 'and'.

* This leaves the 'and' with only one remaining argument.  An 'and' with
  only one argument is equivalent to that argument, so the 'and' can be
  removed, replaced by its argument.

* Since the 'begin' is now within a body (whereas previously it was an
  operand), the 'begin' can now be removed, replaced by its contents.

This is what I did in commit 76c7fc436a151236f5e1ff966fd99172d85ee422 on
master, which I've attached below.

    Thanks,
      Mark


>From 76c7fc436a151236f5e1ff966fd99172d85ee422 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <address@hidden>
Date: Wed, 24 Jan 2018 06:35:29 -0500
Subject: [PATCH] gnu: python-qscintilla: Remove result code plumbing.

* gnu/packages/qt.scm (python-qscintilla)[arguments]: In the 'configure'
phase, remove result code plumbing that is no longer needed, since 'invoke'
never returns #false.
---
 gnu/packages/qt.scm | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 596006080..34938b9c0 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -1715,15 +1715,14 @@ indicators, code completion and call tips.")
          (replace 'configure
            (lambda* (#:key outputs configure-flags #:allow-other-keys)
              (chdir "Python")
-             (and (apply invoke "python3" "configure.py"
-                         configure-flags)
-                  ;; Install to the right directory
-                  (begin
-                    (substitute* '("Makefile"
-                                   "Qsci/Makefile")
-                      (("\\$\\(INSTALL_ROOT\\)/gnu/store/[^/]+")
-                       (assoc-ref outputs "out")))
-                    #t)))))))
+             (apply invoke "python3" "configure.py"
+                    configure-flags)
+             ;; Install to the right directory
+             (substitute* '("Makefile"
+                            "Qsci/Makefile")
+               (("\\$\\(INSTALL_ROOT\\)/gnu/store/[^/]+")
+                (assoc-ref outputs "out")))
+             #t)))))
     (inputs
      `(("qscintilla" ,qscintilla)
        ("python" ,python)
-- 
2.16.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]