GNU bug report logs - #50755
[PATCH] import: Generate list of importers based on available modules

Previous Next

Package: guix-patches;

Reported by: pinoaffe <pinoaffe <at> airmail.cc>

Date: Thu, 23 Sep 2021 12:25:02 UTC

Severity: normal

Tags: patch

Full log


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

From: pinoaffe <pinoaffe <at> airmail.cc>
To: 50755 <at> debbugs.gnu.org
Subject: Re: [bug#50755] [PATCH v2] import: Generate list of importers based
 on available modules
Date: Mon, 27 Sep 2021 20:20:21 +0200
User-agent: mu4e 1.4.15; emacs 27.2
* guix/scripts/import.scm (importers): Generate a list of all importers by
looping over available guile modules, allowing for extensibility.
---
 guix/scripts/import.scm | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm
index 40fa6759ae..71ee8cc00b 100644
--- a/guix/scripts/import.scm
+++ b/guix/scripts/import.scm
@@ -23,6 +23,7 @@
 
 (define-module (guix scripts import)
   #:use-module (guix ui)
+  #:use-module (guix discovery)
   #:use-module (guix scripts)
   #:use-module (guix utils)
   #:use-module (srfi srfi-1)
@@ -78,9 +79,15 @@ rather than \\n."
 ;;; Entry point.
 ;;;
 
-(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "egg" "elpa"
-                    "gem" "go" "cran" "crate" "texlive" "json" "opam"
-                    "minetest"))
+(define importers (delete-duplicates
+                   (filter-map (lambda (module)
+                                 (match (module-name module)
+                                   (`(guix scripts import ,importer)
+                                    (symbol->string importer))
+                                   ( #t #f)))
+                               (all-modules (map (lambda (entry)
+                                                   `(,entry . "guix/scripts/import"))
+                                                 %load-path)))))
 
 (define (resolve-importer name)
   (let ((module (resolve-interface
-- 
2.32.0

Date: Mon, 27 Sep 2021 20:20:21 +0200
Message-ID: <87o88dswwq.fsf <at> airmail.cc>




This bug report was last modified 3 years and 246 days ago.

Previous Next


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