Make zo-path checking available as a library.

This commit is contained in:
Sam Tobin-Hochstadt 2015-12-11 10:14:12 -05:00
parent 6593594ebf
commit acbcff1bf4

View File

@ -1,6 +1,8 @@
#lang racket #lang racket
(require setup/dirs) (require setup/dirs)
(provide check-one)
;; Paths from the build location shouldn't show up in bytecode files ;; Paths from the build location shouldn't show up in bytecode files
;; or documentation. Check ".zo", ".dep", and ".html" files in the ;; or documentation. Check ".zo", ".dep", and ".html" files in the
;; build on the assumption that the first three elements of the ;; build on the assumption that the first three elements of the
@ -14,23 +16,23 @@
(take (explode-path (find-collects-dir)) (take (explode-path (find-collects-dir))
3)))))) 3))))))
(define (check-content rx:name) (define (check-one file)
(lambda (name kind v) (call-with-input-file*
(when (regexp-match? rx:name name) file
(call-with-input-file* name (lambda (in)
(lambda (in) (when (regexp-match? rx:dir in)
(when (regexp-match? rx:dir in) (eprintf "Found ~s in ~s\n" rx:dir file)))))
(eprintf "Found ~s in ~s\n" rx:dir name)))))))
(fold-files (check-content #rx"[.](?:zo|dep)$") (define ((check-content rx:name) name kind v)
(void) (when (regexp-match? rx:name name)
(find-collects-dir)) (check-one name)))
(fold-files (check-content #rx"[.](?:zo|dep)$") (module+ main
(void) (fold-files (check-content #rx"[.](?:zo|dep)$")
(find-pkgs-dir)) (void)
(find-pkgs-dir))
;; Check rendered docs, too: ;; Check rendered docs, too:
(fold-files (check-content #rx"[.](?:html)$") (fold-files (check-content #rx"[.](?:html)$")
(void) (void)
(find-doc-dir)) (find-doc-dir)))