[arch-commits] Commit in python-astor/trunk (2 files)

Evangelos Foutras foutrelis at archlinux.org
Mon Jul 2 10:17:51 UTC 2018


    Date: Monday, July 2, 2018 @ 10:17:51
  Author: foutrelis
Revision: 349474

Python 3.7 rebuild

Added:
  python-astor/trunk/do-not-use-async-as-a-keyword-argument.patch
Modified:
  python-astor/trunk/PKGBUILD

----------------------------------------------+
 PKGBUILD                                     |   10 +-
 do-not-use-async-as-a-keyword-argument.patch |  123 +++++++++++++++++++++++++
 2 files changed, 130 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2018-07-02 10:15:25 UTC (rev 349473)
+++ PKGBUILD	2018-07-02 10:17:51 UTC (rev 349474)
@@ -4,7 +4,7 @@
 pkgbase=python-astor
 pkgname=('python-astor' 'python2-astor')
 pkgver=0.6.2
-pkgrel=1
+pkgrel=2
 pkgdesc="Read/rewrite/write Python ASTs"
 arch=('any')
 license=('BSD')
@@ -11,10 +11,14 @@
 url="http://astor.rtfd.org/"
 makedepends=('python-setuptools' 'python2-setuptools')
 checkdepends=('python-nose' 'python2-nose' 'python2-unittest2')
-source=("$pkgbase-$pkgver.tar.gz::https://github.com/berkerpeksag/astor/archive/$pkgver.tar.gz")
-sha512sums=('ccda3f0432522be1f8ada5589e56a7cb6da83a29fb8d9e0f4167fd492d7d6f55c0f4ed18af81d60340147894978b6ee8efb24edb68b92cdd78d053d5d53c6d66')
+source=("$pkgbase-$pkgver.tar.gz::https://github.com/berkerpeksag/astor/archive/$pkgver.tar.gz"
+        do-not-use-async-as-a-keyword-argument.patch)
+sha512sums=('ccda3f0432522be1f8ada5589e56a7cb6da83a29fb8d9e0f4167fd492d7d6f55c0f4ed18af81d60340147894978b6ee8efb24edb68b92cdd78d053d5d53c6d66'
+            'ebe7126a25694b3b7df65fa5311632cec973802dd38a6d7a57c415f4b3925a1177c4d3f702e1d49b4c203296ff2fd09b4992a36c26084bb1939cd4593d903a20')
 
 prepare() {
+  # https://github.com/berkerpeksag/astor/issues/86
+  patch -d astor-$pkgver -Np1 < do-not-use-async-as-a-keyword-argument.patch
   cp -a astor-$pkgver{,-py2}
 }
 

Added: do-not-use-async-as-a-keyword-argument.patch
===================================================================
--- do-not-use-async-as-a-keyword-argument.patch	                        (rev 0)
+++ do-not-use-async-as-a-keyword-argument.patch	2018-07-02 10:17:51 UTC (rev 349474)
@@ -0,0 +1,123 @@
+From fe1ef7f9d746847c157197e4cb2ab6505fe19faf Mon Sep 17 00:00:00 2001
+From: Berker Peksag <berker.peksag at gmail.com>
+Date: Fri, 23 Mar 2018 16:50:21 +0300
+Subject: [PATCH] Don't use 'async' as a keyword argument (#94)
+
+Fixes #86
+---
+ .travis.yml        |  2 ++
+ astor/code_gen.py  | 18 +++++++++---------
+ docs/changelog.rst | 21 +++++++++++++++++++++
+ 3 files changed, 32 insertions(+), 9 deletions(-)
+
+diff --git a/.travis.yml b/.travis.yml
+index 64bedd8..df42c87 100644
+--- a/.travis.yml
++++ b/.travis.yml
+@@ -9,9 +9,11 @@ python:
+   - 3.6
+   - pypy
+   - pypy3.3-5.2-alpha1
++  - 3.7-dev
+ matrix:
+   allow_failures:
+   - python: 2.6
++  - python: 3.7-dev
+ cache: pip
+ install:
+   - pip install tox-travis
+diff --git a/astor/code_gen.py b/astor/code_gen.py
+index 7c27f70..47d6acc 100644
+--- a/astor/code_gen.py
++++ b/astor/code_gen.py
+@@ -308,8 +308,8 @@ def visit_Expr(self, node):
+         self.statement(node)
+         self.generic_visit(node)
+ 
+-    def visit_FunctionDef(self, node, async=False):
+-        prefix = 'async ' if async else ''
++    def visit_FunctionDef(self, node, is_async=False):
++        prefix = 'async ' if is_async else ''
+         self.decorators(node, 1 if self.indentation else 2)
+         self.statement(node, '%sdef %s' % (prefix, node.name), '(')
+         self.visit_arguments(node.args)
+@@ -322,7 +322,7 @@ def visit_FunctionDef(self, node, async=False):
+ 
+     # introduced in Python 3.5
+     def visit_AsyncFunctionDef(self, node):
+-        self.visit_FunctionDef(node, async=True)
++        self.visit_FunctionDef(node, is_async=True)
+ 
+     def visit_ClassDef(self, node):
+         have_args = []
+@@ -364,24 +364,24 @@ def visit_If(self, node):
+                 self.else_body(else_)
+                 break
+ 
+-    def visit_For(self, node, async=False):
++    def visit_For(self, node, is_async=False):
+         set_precedence(node, node.target)
+-        prefix = 'async ' if async else ''
++        prefix = 'async ' if is_async else ''
+         self.statement(node, '%sfor ' % prefix,
+                        node.target, ' in ', node.iter, ':')
+         self.body_or_else(node)
+ 
+     # introduced in Python 3.5
+     def visit_AsyncFor(self, node):
+-        self.visit_For(node, async=True)
++        self.visit_For(node, is_async=True)
+ 
+     def visit_While(self, node):
+         set_precedence(node, node.test)
+         self.statement(node, 'while ', node.test, ':')
+         self.body_or_else(node)
+ 
+-    def visit_With(self, node, async=False):
+-        prefix = 'async ' if async else ''
++    def visit_With(self, node, is_async=False):
++        prefix = 'async ' if is_async else ''
+         self.statement(node, '%swith ' % prefix)
+         if hasattr(node, "context_expr"):  # Python < 3.3
+             self.visit_withitem(node)
+@@ -392,7 +392,7 @@ def visit_With(self, node, async=False):
+ 
+     # new for Python 3.5
+     def visit_AsyncWith(self, node):
+-        self.visit_With(node, async=True)
++        self.visit_With(node, is_async=True)
+ 
+     # new for Python 3.3
+     def visit_withitem(self, node):
+diff --git a/docs/changelog.rst b/docs/changelog.rst
+index 54bc9b7..fcfc2b8 100644
+--- a/docs/changelog.rst
++++ b/docs/changelog.rst
+@@ -2,6 +2,27 @@
+ Release Notes
+ =============
+ 
++0.7.0 - 2018-03-24
++------------------
++
++New features
++~~~~~~~~~~~~
++
++* Added initial support for Python 3.7.0.
++
++  Note that if you have a subclass of ``astor.code_gen.SourceGenerator``, you
++  may need to rename the keyword argument ``async`` of the following methods
++  to ``is_async``:
++
++  - ``visit_FunctionDef(..., is_async=False)``
++  - ``visit_For(..., is_async=False)``
++  - ``visit_With(..., is_async=False)``
++
++  (Reported and fixed by Berker Peksag in `Issue 86`_.)
++
++.. _`Issue 86`: https://github.com/berkerpeksag/astor/issues/86
++
++
+ 0.6.2 - 2017-11-11
+ ------------------
+ 



More information about the arch-commits mailing list