summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2019-05-20 23:33:47 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2019-06-26 11:08:44 +0900
commitdae2eb1c127c636226ba11d05ec638f113a3c831 (patch)
tree1efa85d06acae14451014e43ebf5841c89860d5e
parent5a7e7ca1d7a656cd8f6d8e43d686ee087d21aabe (diff)
downloadguix-dae2eb1c127c636226ba11d05ec638f113a3c831.tar.gz
gnu: Add python-typed-ast.
* gnu/packages/python-xyz.scm (python-typed-ast): New variable.
-rw-r--r--gnu/packages/python-xyz.scm45
1 files changed, 45 insertions, 0 deletions
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index d09e107bc4..cb3a695bca 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -14036,6 +14036,51 @@ source bytes using the UTF-8 encoding and then rewrites Python 3.6 style
 @code{f} strings.")
     (license license:expat)))
 
+(define-public python-typed-ast
+  (package
+    (name "python-typed-ast")
+    (version "1.3.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "typed-ast" version))
+       (sha256
+        (base32
+         "1m7pr6qpana3cvqwiw7mlvrgvmw27ch5mx1592572xhlki8g85ak"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:modules ((guix build utils)
+                  (guix build python-build-system)
+                  (ice-9 ftw)
+                  (srfi srfi-1)
+                  (srfi srfi-26))
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (let ((cwd (getcwd)))
+               (setenv "PYTHONPATH"
+                       (string-append cwd "/build/"
+                                      (find (cut string-prefix? "lib" <>)
+                                            (scandir (string-append cwd "/build")))
+                                      ":"
+                                      (getenv "PYTHONPATH"))))
+             (invoke "pytest")
+             #t)))))
+    (native-inputs `(("python-pytest" ,python-pytest)))
+    (home-page "https://github.com/python/typed_ast")
+    (synopsis "Fork of Python @code{ast} modules with type comment support")
+    (description "This package provides a parser similar to the standard
+@code{ast} library.  Unlike @code{ast}, the parsers in @code{typed_ast}
+include PEP 484 type comments and are independent of the version of Python
+under which they are run.  The @code{typed_ast} parsers produce the standard
+Python AST (plus type comments), and are both fast and correct, as they are
+based on the CPython 2.7 and 3.7 parsers.")
+    ;; See the file "LICENSE" for the details.
+    (license (list license:psfl
+                   license:asl2.0
+                   license:expat))))    ;ast27/Parser/spark.py
+
 (define-public python-typing
   (package
     (name "python-typing")