mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-18 13:36:36 +01:00
import/cran: Enhance import pattern.
* guix/import/cran.scm (import-pattern): Comment; capture direct namespace imports as well as silent imports. Change-Id: Ia54035d6f230d695aa950adb3e691cbce4f2d416
This commit is contained in:
parent
066d769293
commit
71f82174a5
1 changed files with 23 additions and 7 deletions
|
@ -552,10 +552,23 @@ (define (needed-libraries-in-directory dir)
|
||||||
(set)
|
(set)
|
||||||
(find-files dir "(Makevars(.in.*)?|configure.*)"))))
|
(find-files dir "(Makevars(.in.*)?|configure.*)"))))
|
||||||
|
|
||||||
;; A pattern matching "library" or "require" statements, capturing the first
|
;; A pattern matching package imports. It detects uses of "library" or
|
||||||
;; argument.
|
;; "require", capturing the first argument; it also detects direct access of
|
||||||
|
;; namespaces via "::" or ":::", capturing the namespace.
|
||||||
(define import-pattern
|
(define import-pattern
|
||||||
(make-regexp "^ *(require|library)\\(\"?([^, \")]+)"))
|
(make-regexp
|
||||||
|
(string-append
|
||||||
|
;; Ignore leading spaces, but don't capture commented expressions.
|
||||||
|
"(^ *"
|
||||||
|
;; Quiet imports
|
||||||
|
"(suppressPackageStartupMessages\\()?"
|
||||||
|
;; the actual import statement.
|
||||||
|
"(require|library)\\(\"?([^, \")]+)"
|
||||||
|
;; Or perhaps...
|
||||||
|
"|"
|
||||||
|
;; ...direct namespace access.
|
||||||
|
" *([A-Za-z0-9]+):::?"
|
||||||
|
")")))
|
||||||
|
|
||||||
(define (needed-test-inputs-in-directory dir)
|
(define (needed-test-inputs-in-directory dir)
|
||||||
"Return a set of R package names that are found in library import
|
"Return a set of R package names that are found in library import
|
||||||
|
@ -581,8 +594,10 @@ (define (needed-test-inputs-in-directory dir)
|
||||||
(else
|
(else
|
||||||
(loop
|
(loop
|
||||||
(fold (lambda (match acc)
|
(fold (lambda (match acc)
|
||||||
(let ((imported (match:substring match 2)))
|
(let ((imported (or (match:substring match 4)
|
||||||
(if (or (string=? imported package-directory-name)
|
(match:substring match 5))))
|
||||||
|
(if (or (not imported)
|
||||||
|
(string=? imported package-directory-name)
|
||||||
(member imported default-r-packages))
|
(member imported default-r-packages))
|
||||||
acc
|
acc
|
||||||
(set-insert imported acc))))
|
(set-insert imported acc))))
|
||||||
|
@ -623,8 +638,9 @@ (define (needed-vignettes-inputs-in-directory dir)
|
||||||
(else
|
(else
|
||||||
(loop
|
(loop
|
||||||
(fold (lambda (match acc)
|
(fold (lambda (match acc)
|
||||||
(let ((imported (match:substring match 2)))
|
(let ((imported (match:substring match 4)))
|
||||||
(if (or (string=? imported package-directory-name)
|
(if (or (not imported)
|
||||||
|
(string=? imported package-directory-name)
|
||||||
(member imported default-r-packages))
|
(member imported default-r-packages))
|
||||||
acc
|
acc
|
||||||
(set-insert imported acc))))
|
(set-insert imported acc))))
|
||||||
|
|
Loading…
Reference in a new issue