fix cm to configure reader when reading .dep files
Merge to 5.1.2
(cherry picked from commit 7af5d490ad
)
This commit is contained in:
parent
34b3045b9b
commit
9e3ee9e2f8
|
@ -7,7 +7,8 @@
|
||||||
scheme/list
|
scheme/list
|
||||||
scheme/path
|
scheme/path
|
||||||
racket/promise
|
racket/promise
|
||||||
openssl/sha1)
|
openssl/sha1
|
||||||
|
syntax/private/modread)
|
||||||
|
|
||||||
(provide make-compilation-manager-load/use-compiled-handler
|
(provide make-compilation-manager-load/use-compiled-handler
|
||||||
managed-compile-zo
|
managed-compile-zo
|
||||||
|
@ -465,11 +466,13 @@
|
||||||
-inf.0))
|
-inf.0))
|
||||||
|
|
||||||
(define (try-file-sha1 path dep-path)
|
(define (try-file-sha1 path dep-path)
|
||||||
|
(with-module-reading-parameterization
|
||||||
|
(lambda ()
|
||||||
(with-handlers ([exn:fail:filesystem? (lambda (exn) #f)])
|
(with-handlers ([exn:fail:filesystem? (lambda (exn) #f)])
|
||||||
(string-append
|
(string-append
|
||||||
(call-with-input-file* path sha1)
|
(call-with-input-file* path sha1)
|
||||||
(with-handlers ([exn:fail:filesystem? (lambda (exn) "")])
|
(with-handlers ([exn:fail:filesystem? (lambda (exn) "")])
|
||||||
(call-with-input-file* dep-path (lambda (p) (cdadr (read p))))))))
|
(call-with-input-file* dep-path (lambda (p) (cdadr (read p))))))))))
|
||||||
|
|
||||||
(define (get-compiled-sha1 mode path)
|
(define (get-compiled-sha1 mode path)
|
||||||
(define-values (dir name) (get-compilation-dir+name mode path))
|
(define-values (dir name) (get-compilation-dir+name mode path))
|
||||||
|
@ -492,9 +495,11 @@
|
||||||
(define orig-path (simple-form-path path0))
|
(define orig-path (simple-form-path path0))
|
||||||
(define (read-deps path)
|
(define (read-deps path)
|
||||||
(with-handlers ([exn:fail:filesystem? (lambda (ex) (list (version) '#f))])
|
(with-handlers ([exn:fail:filesystem? (lambda (ex) (list (version) '#f))])
|
||||||
|
(with-module-reading-parameterization
|
||||||
|
(lambda ()
|
||||||
(call-with-input-file
|
(call-with-input-file
|
||||||
(path-add-suffix (get-compilation-path mode path) #".dep")
|
(path-add-suffix (get-compilation-path mode path) #".dep")
|
||||||
read)))
|
read)))))
|
||||||
(define (do-check)
|
(define (do-check)
|
||||||
(let* ([main-path orig-path]
|
(let* ([main-path orig-path]
|
||||||
[alt-path (rkt->ss orig-path)]
|
[alt-path (rkt->ss orig-path)]
|
||||||
|
|
|
@ -1,27 +1,11 @@
|
||||||
(module modread mzscheme
|
(module modread mzscheme
|
||||||
(require racket/contract)
|
(require racket/contract
|
||||||
|
"private/modread.rkt")
|
||||||
|
|
||||||
(provide with-module-reading-parameterization)
|
(provide with-module-reading-parameterization)
|
||||||
(provide/contract
|
(provide/contract
|
||||||
[check-module-form ((or/c syntax? eof-object?) symbol? (or/c string? path? false/c) . -> . any)])
|
[check-module-form ((or/c syntax? eof-object?) symbol? (or/c string? path? false/c) . -> . any)])
|
||||||
|
|
||||||
(define (with-module-reading-parameterization thunk)
|
|
||||||
(parameterize ([read-case-sensitive #t]
|
|
||||||
[read-square-bracket-as-paren #t]
|
|
||||||
[read-curly-brace-as-paren #t]
|
|
||||||
[read-accept-box #t]
|
|
||||||
[read-accept-compiled #t]
|
|
||||||
[read-accept-bar-quote #t]
|
|
||||||
[read-accept-graph #t]
|
|
||||||
[read-decimal-as-inexact #t]
|
|
||||||
[read-accept-dot #t]
|
|
||||||
[read-accept-infix-dot #t]
|
|
||||||
[read-accept-quasiquote #t]
|
|
||||||
[read-accept-reader #t]
|
|
||||||
[read-accept-lang #t]
|
|
||||||
[current-readtable #f])
|
|
||||||
(thunk)))
|
|
||||||
|
|
||||||
(define (raise-wrong-module-name filename expected-name name)
|
(define (raise-wrong-module-name filename expected-name name)
|
||||||
(error 'load-handler
|
(error 'load-handler
|
||||||
"expected a `module' declaration for `~a' in ~s, found: ~a"
|
"expected a `module' declaration for `~a' in ~s, found: ~a"
|
||||||
|
|
20
collects/syntax/private/modread.rkt
Normal file
20
collects/syntax/private/modread.rkt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#lang racket/base
|
||||||
|
|
||||||
|
(provide with-module-reading-parameterization)
|
||||||
|
|
||||||
|
(define (with-module-reading-parameterization thunk)
|
||||||
|
(parameterize ([read-case-sensitive #t]
|
||||||
|
[read-square-bracket-as-paren #t]
|
||||||
|
[read-curly-brace-as-paren #t]
|
||||||
|
[read-accept-box #t]
|
||||||
|
[read-accept-compiled #t]
|
||||||
|
[read-accept-bar-quote #t]
|
||||||
|
[read-accept-graph #t]
|
||||||
|
[read-decimal-as-inexact #t]
|
||||||
|
[read-accept-dot #t]
|
||||||
|
[read-accept-infix-dot #t]
|
||||||
|
[read-accept-quasiquote #t]
|
||||||
|
[read-accept-reader #t]
|
||||||
|
[read-accept-lang #t]
|
||||||
|
[current-readtable #f])
|
||||||
|
(thunk)))
|
Loading…
Reference in New Issue
Block a user