summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-09-12 21:38:35 +0200
committerStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-09-12 21:38:35 +0200
commite41b5160334b9e4195c55300fd9bc1901dec1d43 (patch)
treea569a7b9bbe77b0f533f594dddf3b41bf081d5ae
parent02ed5ec9f06962b4ea5abb389a7c3d009af64524 (diff)
relative references in import
-rw-r--r--modules/language/python/compile.scm17
1 files changed, 11 insertions, 6 deletions
diff --git a/modules/language/python/compile.scm b/modules/language/python/compile.scm
index a45cc48..394e8d9 100644
--- a/modules/language/python/compile.scm
+++ b/modules/language/python/compile.scm
@@ -1384,13 +1384,18 @@
l)))))
- ((_ (#:name ((ids ...) . as) ...) ...)
+ ((_ (#:name ((dots ids ...) . as) ...) ...)
`(,(G 'begin)
,@(map
- (lambda (ids as)
+ (lambda (dots ids as)
`(,(G 'begin)
- ,@(map (lambda (ids as)
- (let ((path (map (g vs exp) ids)))
+ ,@(map (lambda (dots ids as)
+ (let* ((u (module-name (current-module)))
+ (u (reverse (list-cdr-ref (reverse (u-it u))
+ (length dots))))
+
+ (path (append (if (null? dots) '() u)
+ (map (g vs exp) ids))))
(if as
(exp
vs
@@ -1418,8 +1423,8 @@
,(append '(language python module)
path)))
,(exp vs (car ids)))))))))))
- ids as)))
- ids as))))
+ dots ids as)))
+ dots ids as))))
(#:for
((_ e in code . #f)