guix-commits
[Top][All Lists]
Advanced

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

07/07: gnu: cpplint: Reduce closure size.


From: guix-commits
Subject: 07/07: gnu: cpplint: Reduce closure size.
Date: Wed, 9 Feb 2022 18:25:09 -0500 (EST)

mbakke pushed a commit to branch master
in repository guix.

commit f97fe92b570b01ed1b03abd4f3ec89bf20ebc9db
Author: Marius Bakke <marius@gnu.org>
AuthorDate: Wed Feb 9 23:38:10 2022 +0100

    gnu: cpplint: Reduce closure size.
    
    * gnu/packages/cpp.scm (cpplint)[arguments]: Add #:modules.  Add phases to
    adjust GUIX_PYTHONPATH before the wrap phase.
---
 gnu/packages/cpp.scm | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 09ba10d9ab..86138531c0 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -780,8 +780,35 @@ library.")
         (base32 "13l86aq0h1jga949k79k9x3hw2xqchjc162sclg2f99vz98zcz15"))
        (file-name (git-file-name name version))))
     (arguments
-     (list #:phases
-           #~(modify-phases %standard-phases
+     (list #:modules `((srfi srfi-1)
+                       (srfi srfi-26)
+                       ,@%python-build-system-modules)
+           #:phases
+           #~(modify-phases (@ (guix build python-build-system) 
%standard-phases)
+               (add-before 'wrap 'reduce-GUIX_PYTHONPATH
+                 (lambda _
+                   ;; Hide the transitive native inputs from GUIX_PYTHONPATH
+                   ;; to prevent them from ending up in the run-time closure.
+                   ;; See also <https://bugs.gnu.org/25235>.
+                   (let ((transitive-native-inputs
+                          '#$(match (package-transitive-native-inputs
+                                     this-package)
+                               (((labels packages) ...) packages))))
+                     ;; Save the original PYTHONPATH because we need it for
+                     ;; tests later.
+                     (setenv "TMP_PYTHONPATH" (getenv "GUIX_PYTHONPATH"))
+                     (setenv "GUIX_PYTHONPATH"
+                             (string-join
+                              (filter (lambda (path)
+                                        (not (any (cut string-prefix? <> path)
+                                                  transitive-native-inputs)))
+                                      (search-path-as-string->list
+                                       (getenv "GUIX_PYTHONPATH")))
+                              ":")))))
+               (add-after 'wrap 'reset-GUIX_PYTHONPATH
+                 (lambda _
+                   (setenv "GUIX_PYTHONPATH"
+                           (getenv "TMP_PYTHONPATH"))))
                (replace 'check
                  (lambda* (#:key tests? #:allow-other-keys)
                    (when tests?



reply via email to

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