diff --git a/tools/module-deps.scm b/tools/module-deps.scm index 100662e..d5f3e35 100644 --- a/tools/module-deps.scm +++ b/tools/module-deps.scm @@ -23,6 +23,7 @@ (import scheme (chicken base) (chicken condition) + (chicken eval) (chicken file) (chicken io) (chicken pathname) @@ -43,11 +44,22 @@ ;;; module the tests import (define eggs (call-with-input-file "dependencies.txt" read-list)) +;;; A scheme.scm is not the module every unit imports. Asked from /, +;;; since here a NAME.import.scm built from NAME.scm would answer +(define (chicken-module? name) + (let ((here (current-directory))) + (dynamic-wind + (lambda () (change-directory "/")) + (lambda () (handle-exceptions exn #f (module-environment name) #t)) + (lambda () (change-directory here))))) + (define (module-file name) (and (symbol? name) (not (memq name eggs)) (let ((file (string-append (symbol->string name) ".scm"))) - (and (file-exists? file) file)))) + (and (file-exists? file) + (not (chicken-module? name)) + file)))) ;;; FILE's forms, or the end of the scan, naming the file that has none (define (forms-of file)