Reorganize module and function names to reflect file tree work.
svn: r17547
This commit is contained in:
parent
6199fc8867
commit
133f378991
|
@ -1,13 +1,13 @@
|
||||||
#lang scheme/base
|
#lang scheme/base
|
||||||
|
|
||||||
(provide get-tree get-plt-tree)
|
(provide get-file-tree get-plt-file-tree)
|
||||||
|
|
||||||
(require "tree.ss" setup/dirs)
|
(require "tree.ss" setup/dirs)
|
||||||
|
|
||||||
;; ----------------------------------------------------------------------------
|
;; ----------------------------------------------------------------------------
|
||||||
;; Reading a tree from a directory
|
;; Reading a tree from a directory
|
||||||
|
|
||||||
(define (get-tree path)
|
(define (get-file-tree path)
|
||||||
(define path* (simplify-path path))
|
(define path* (simplify-path path))
|
||||||
(let loop ([path path*]
|
(let loop ([path path*]
|
||||||
[name (regexp-replace #rx#"/$" (path->bytes path*) #"")])
|
[name (regexp-replace #rx#"/$" (path->bytes path*) #"")])
|
||||||
|
@ -24,28 +24,28 @@
|
||||||
subs)))
|
subs)))
|
||||||
path)]
|
path)]
|
||||||
[(file-exists? path) (make-tree name #f path)]
|
[(file-exists? path) (make-tree name #f path)]
|
||||||
[else (error 'get-tree "bad path encountered: ~a/~a"
|
[else (error 'get-file-tree "bad path encountered: ~a/~a"
|
||||||
(current-directory) path)])))
|
(current-directory) path)])))
|
||||||
|
|
||||||
;; ----------------------------------------------------------------------------
|
;; ----------------------------------------------------------------------------
|
||||||
;; Reading the PLT tree
|
;; Reading the PLT tree
|
||||||
|
|
||||||
(define (get-plt-tree)
|
(define (get-plt-file-tree)
|
||||||
(when absolute-installation?
|
(when absolute-installation?
|
||||||
(error 'get-plt-tree "must be used from a relative installation"))
|
(error 'get-plt-tree "must be used from a relative installation"))
|
||||||
(get-tree (build-path (find-collects-dir) 'up)))
|
(get-file-tree (build-path (find-collects-dir) 'up)))
|
||||||
|
|
||||||
#| good for benchmarking changes
|
#| good for benchmarking changes
|
||||||
(printf "getting tree ")
|
(printf "getting tree ")
|
||||||
(define t (time (get-plt-tree)))
|
(define t (time (get-plt-file-tree)))
|
||||||
;;!!! (printf "adding deps ")
|
;;!!! (printf "adding deps ")
|
||||||
;;!!! (time (add-deps! t))
|
;;!!! (time (add-deps! t))
|
||||||
(printf "filtering x 1000 ")
|
(printf "filtering x 1000 ")
|
||||||
(time
|
(time
|
||||||
(for ([i (in-range 1000)]) ; print-tree
|
(for ([i (in-range 1000)])
|
||||||
(tree-filter
|
(tree-filter
|
||||||
(not: (or: "**/.svn/" "**/compiled/"))
|
(not: (or: "**/.svn/" "**/compiled/"))
|
||||||
;; (get-tree "/home/scheme/plt/collects/scribble/.svn")
|
;; (get-file-tree "/home/scheme/plt/collects/scribble/.svn")
|
||||||
t
|
t
|
||||||
)))
|
)))
|
||||||
|#
|
|#
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
(require tests/eli-tester scheme/sandbox scheme/runtime-path scheme/file)
|
(require tests/eli-tester scheme/sandbox scheme/runtime-path scheme/file)
|
||||||
|
|
||||||
(define-runtime-path tree-module "tree.ss")
|
(define-runtime-path tree-module "tree.ss")
|
||||||
(define-runtime-path plt-tree-module "plt-tree.ss")
|
(define-runtime-path file-tree-module "file-tree.ss")
|
||||||
|
|
||||||
(define (glob-tests)
|
(define (glob-tests)
|
||||||
(define e
|
(define e
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
(define (tree-tests)
|
(define (tree-tests)
|
||||||
(define e
|
(define e
|
||||||
(call-with-trusted-sandbox-configuration
|
(call-with-trusted-sandbox-configuration
|
||||||
(lambda () (make-module-evaluator plt-tree-module))))
|
(lambda () (make-module-evaluator file-tree-module))))
|
||||||
(define a-dir (collection-path "scribble"))
|
(define a-dir (collection-path "scribble"))
|
||||||
(define a-list (find-files void a-dir))
|
(define a-list (find-files void a-dir))
|
||||||
(define a-tree #f)
|
(define a-tree #f)
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
=> '(-/ -/0 -/A1/ -/A1/1 -/A1/3 -/A1/B/ -/A1/B/4 -/A1/C -/A2/)
|
=> '(-/ -/0 -/A1/ -/A1/1 -/A1/3 -/A1/B/ -/A1/B/4 -/A1/C -/A2/)
|
||||||
(e/filter '(not: "*/{2|5}"))
|
(e/filter '(not: "*/{2|5}"))
|
||||||
=> '(-/ -/0 -/A1/ -/A1/1 -/A1/3 -/A1/B/ -/A1/B/4 -/A1/C -/A2/)
|
=> '(-/ -/0 -/A1/ -/A1/1 -/A1/3 -/A1/B/ -/A1/B/4 -/A1/C -/A2/)
|
||||||
(set! a-tree (e `(get-tree ,a-dir)))
|
(set! a-tree (e `(get-file-tree ,a-dir)))
|
||||||
(e `(map tree-path (tree->list ,a-tree)))
|
(e `(map tree-path (tree->list ,a-tree)))
|
||||||
=> a-list
|
=> a-list
|
||||||
(e/filter #"*")
|
(e/filter #"*")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user