Correctly substitute directory names in 'python' executable.
[software/python-on-guile.git] / modules / python.in
1 #!@GUILE@ \
2 --no-auto-compile -e main -s
3 !#
4
5 (eval-when (expand load eval)
6 (set! %load-path
7 (cons "@datadir@/guile/site/@GUILE_EFFECTIVE_VERSION@" %load-path))
8 (set! %load-compiled-path
9 (cons "@libdir@/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache"
10 %load-compiled-path)))
11
12 (use-modules (ice-9 match)
13 (language python spec)
14 (language python module python)
15 (system repl common)
16 (system repl repl))
17
18 (define* (main #:optional (args (command-line)))
19 (match args
20 ((_ file)
21 (let ((compiled (string-append file ".go")))
22 (compile-file file
23 #:from python
24 #:output-file compiled)
25 (load-compiled compiled)))
26 ((_)
27 (repl-default-option-set! 'prompt ">>> ")
28 (set! (@@ (system repl common) repl-welcome)
29 (const (display "\
30 Python on Guile, version @VERSION@
31 (Hit Ctrl-D to exit.)
32 ")))
33 (start-repl python)
34 #t)
35 (_ (format (current-error-port)
36 "usage: ~a file.py~%" this))))