Correctly substitute directory names in 'python' executable.
[software/python-on-guile.git] / python.diff
1 diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm
2 index c110512f0..83a3b479d 100644
3 --- a/module/system/base/compile.scm
4 +++ b/module/system/base/compile.scm
5 @@ -132,14 +132,38 @@
6 (and (false-if-exception (ensure-directory (dirname f)))
7 f))))
8
9 +(define *do-extension-dispatch* #f)
10 +(define *extension-dispatches* '((("py") . python) (("pl") . prolog)))
11 +
12 +(define (default-language file)
13 + (define default (current-language))
14 + (if *do-extension-dispatch*
15 + (let ((ext (car (reverse (string-split file #\.)))))
16 + (let lp ((l *extension-dispatches*))
17 + (if (pair? l)
18 + (if (member ext (caar l))
19 + (let ((r (cdar l)))
20 + (if (language? default)
21 + (if (eq? (language-name default) r)
22 + default
23 + r)
24 + r))
25 + (lp (cdr l)))
26 + default)))
27 + default))
28 +
29 +
30 +(define %in-compile (make-fluid #f))
31 +
32 (define* (compile-file file #:key
33 (output-file #f)
34 - (from (current-language))
35 + (from (default-language file))
36 (to 'bytecode)
37 (env (default-environment from))
38 (opts '())
39 (canonicalization 'relative))
40 - (with-fluids ((%file-port-name-canonicalization canonicalization))
41 + (with-fluids ((%in-compile #t)
42 + (%file-port-name-canonicalization canonicalization))
43 (let* ((comp (or output-file (compiled-file-name file)
44 (error "failed to create path for auto-compiled file"
45 file)))
46 diff --git a/module/system/base/message.scm b/module/system/base/message.scm
47 index 979291c1e..c0d639235 100644
48 --- a/module/system/base/message.scm
49 +++ b/module/system/base/message.scm
50 @@ -34,7 +34,8 @@
51 warning-type? warning-type-name warning-type-description
52 warning-type-printer lookup-warning-type
53
54 - %warning-types))
55 + %warning-types
56 + %dont-warn-list))
57
58 \f
59 ;;;
60 @@ -74,6 +75,7 @@
61 (description warning-type-description)
62 (printer warning-type-printer))
63
64 +(define %dont-warn-list '())
65 (define %warning-types
66 ;; List of known warning types.
67 (map (lambda (args)
68 @@ -112,8 +114,9 @@
69 (unbound-variable
70 "report possibly unbound variables"
71 ,(lambda (port loc name)
72 - (emit port "~A: warning: possibly unbound variable `~A'~%"
73 - loc name)))
74 + (if (not (member name %dont-warn-list))
75 + (emit port "~A: warning: possibly unbound variable `~A'~%"
76 + loc name))))
77
78 (macro-use-before-definition
79 "report possibly mis-use of macros before they are defined"