diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-09-23 21:01:17 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-09-23 22:23:47 +0200 |
commit | 0c0142881f769b6c42a8a69bec490ba9e98ccf48 (patch) | |
tree | 515f790266a701a590f04ea589436c54ed3c44b7 /scripts/module-dependants.scm | |
parent | Move graphviz to main tree. (diff) | |
download | calp-0c0142881f769b6c42a8a69bec490ba9e98ccf48.tar.gz calp-0c0142881f769b6c42a8a69bec490ba9e98ccf48.tar.xz |
Move all generally usable scripts to module dir.
Diffstat (limited to '')
-rwxr-xr-x | module/scripts/module-dependants.scm (renamed from scripts/module-dependants.scm) | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/scripts/module-dependants.scm b/module/scripts/module-dependants.scm index 2880446c..630da519 100755 --- a/scripts/module-dependants.scm +++ b/module/scripts/module-dependants.scm @@ -1,9 +1,3 @@ -#!/usr/bin/env bash -GUILE=${GUILE:-guile} -set -x -exec $GUILE -e main -s "$0" "$@" -!# - ;;; Commentary: ;;; ;;; For a given module in the project, finds all other modules who uses that @@ -11,26 +5,22 @@ exec $GUILE -e main -s "$0" "$@" ;;; ;;; Code: -(define module-dir (string-append - (dirname (dirname (current-filename))) - "/module")) - -(add-to-load-path module-dir) -(add-to-load-path (dirname (current-filename))) +(define-module (scripts module-dependants) + :use-module (hnh util) + :use-module (hnh util path) + :use-module (srfi srfi-1) + :use-module (srfi srfi-71) + :use-module (ice-9 ftw) + :use-module (texinfo string-utils) + :use-module (hnh module-introspection) + :use-module ((hnh module-introspection static-util) :select (get-forms)) + :export (main)) - -(use-modules (hnh util) - (hnh util path) - (srfi srfi-1) - (srfi srfi-71) - (ice-9 ftw) - (texinfo string-utils) - (module-introspection) - ((static-util) :select (get-forms))) +(define %summary "Print all modules which depend on module specified in target file.") +(define %synopsis "module-dependants TARGET-FILE") (define cstat (make-object-property)) - (define (find-all-files-under directory) (file-system-fold ;; enter? @@ -62,8 +52,8 @@ exec $GUILE -e main -s "$0" "$@" (lambda (filename) (regexp-exec re filename)))) -(define (main args) - (define target-file (realpath (cadr args))) +(define (main . args) + (define target-file (realpath (car args))) (define target-forms (reverse (call-with-input-file target-file get-forms))) (define target-module @@ -93,7 +83,13 @@ exec $GUILE -e main -s "$0" "$@" (delete target-file (filter (filename-extension? ".scm") (filter regular-file? - (find-all-files-under module-dir))))))) + (append-map (lambda (module-dir) + (find-all-files-under module-dir)) + ;; TODO this should be %load-path, but get-forms claims + ;; some files contains invalid syntax. + #; %load-path + '("module") + ))))))) (define file-uses (make-hash-table)) |