use yml data structures with python parser
This commit is contained in:
10
scm/yaml_parser.scm
Normal file
10
scm/yaml_parser.scm
Normal file
@ -0,0 +1,10 @@
|
||||
(use-modules (ice-9 popen) (ice-9 textual-ports) (json parser))
|
||||
|
||||
(define (yml-file->scm filename)
|
||||
(let* ((python_cmd (string-append "import sys, yaml, json; print(json.dumps(yaml.safe_load(open('" filename "'))))"))
|
||||
(pipe (open-pipe* OPEN_READ "python" "-c" python_cmd))
|
||||
(json (get-string-all pipe)))
|
||||
(close-pipe pipe)
|
||||
(json-string->scm json)))
|
||||
|
||||
(define (parse-yml-file filename) (resolve-inherits (yml-file->scm filename)))
|
Reference in New Issue
Block a user