[arch-commits] Commit in python-astor/trunk (PKGBUILD string-newline.patch)
Felix Yan
felixonmars at archlinux.org
Fri May 31 08:11:47 UTC 2019
Date: Friday, May 31, 2019 @ 08:11:47
Author: felixonmars
Revision: 475864
upgpkg: python-astor 0.8-1
Modified:
python-astor/trunk/PKGBUILD
Deleted:
python-astor/trunk/string-newline.patch
----------------------+
PKGBUILD | 16 ++++----------
string-newline.patch | 56 -------------------------------------------------
2 files changed, 5 insertions(+), 67 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2019-05-31 07:35:39 UTC (rev 475863)
+++ PKGBUILD 2019-05-31 08:11:47 UTC (rev 475864)
@@ -1,8 +1,8 @@
# Maintainer: Felix Yan <felixonmars at archlinux.org>
pkgname=python-astor
-pkgver=0.7.1
-pkgrel=2
+pkgver=0.8
+pkgrel=1
pkgdesc="Read/rewrite/write Python ASTs"
arch=('any')
license=('BSD')
@@ -10,15 +10,9 @@
depends=('python')
makedepends=('python-setuptools')
checkdepends=('python-nose')
-source=("$pkgname-$pkgver.tar.gz::https://github.com/berkerpeksag/astor/archive/$pkgver.tar.gz"
- string-newline.patch)
-sha512sums=('02764e5751e4c4b0ffa83da262b87e0a6bf027461529a99d3ca01a415db0896754f2b3f278e8a28f9bce4972ee7a75eec4eec5ac47d1064e6d6656a007b38a64'
- 'ad977606c1b0374dccece65a9743e875e250e86d923c987eee7babb09f1209a874a7b447f253e1666364da32e309579d261ac70cf32b3d909c9fe78501b19cb8')
+source=("$pkgname-$pkgver.tar.gz::https://github.com/berkerpeksag/astor/archive/$pkgver.tar.gz")
+sha512sums=('ca787234f9a9caae37633be289d6e980e7b44507d74306ad7a30f017442d6cf423748ef35465b7b5d12bdb84ce4594af801de39882f4c11c732dba4dc65ab667')
-prepare() {
- patch -d astor-$pkgver -p1 -i ../string-newline.patch
-}
-
build() {
cd astor-$pkgver
python setup.py build
@@ -26,7 +20,7 @@
check() {
cd astor-$pkgver
- nosetests3 || warning "https://github.com/berkerpeksag/astor/issues/124"
+ nosetests3 || warning "https://github.com/berkerpeksag/astor/issues/146"
}
package() {
Deleted: string-newline.patch
===================================================================
--- string-newline.patch 2019-05-31 07:35:39 UTC (rev 475863)
+++ string-newline.patch 2019-05-31 08:11:47 UTC (rev 475864)
@@ -1,56 +0,0 @@
-commit 33f0e57bc84f0cd5cdf994127d81c99f2a23f659
-Author: Felix Yan <felixonmars at archlinux.org>
-Date: Wed Feb 20 01:56:35 2019 +0800
-
- Fix string parsing with newline
-
- When looping over a joined str, if a node is ast.Str and the value is
- just a newline "\n", the write() function adds an additional indentation
- after it, which fails to represent the original string. By calling
- self.result.append() here directly the issue is resolved.
-
- The added test could show the issue. With code_gen unmodifed, it fails
- with the following error:
-
- ```
- AssertionError: "if 1:\n x = f'{host}\\n\\t{port}\\n '" != "if
- 1:\n x = f'{host}\\n\\t{port}\\n'"
- if 1:
- - x = f'{host}\n\t{port}\n '?
- ----
- + x = f'{host}\n\t{port}\n'
- ```
-
- Which is exactly the problem.
-
- This fixes parsing issues with many of Python 3.7's stdlib.
-
-diff --git a/astor/code_gen.py b/astor/code_gen.py
-index 157d2cc..453d108 100644
---- a/astor/code_gen.py
-+++ b/astor/code_gen.py
-@@ -566,7 +566,7 @@ class SourceGenerator(ExplicitNodeVisitor):
- def recurse(node):
- for value in node.values:
- if isinstance(value, ast.Str):
-- self.write(value.s)
-+ self.result.append(value.s)
- elif isinstance(value, ast.FormattedValue):
- with self.delimit('{}'):
- self.visit(value.value)
-diff --git a/tests/test_code_gen.py b/tests/test_code_gen.py
-index 3a8be7b..0db4279 100644
---- a/tests/test_code_gen.py
-+++ b/tests/test_code_gen.py
-@@ -516,6 +516,11 @@ class CodegenTestCase(unittest.TestCase, Comparisons):
- x = f"""{host}\n\t{port}\n"""
- '''
- self.assertSrcRoundtripsGtVer(source, (3, 6))
-+ source = '''
-+ if 1:
-+ x = f'{host}\\n\\t{port}\\n'
-+ '''
-+ self.assertSrcRoundtripsGtVer(source, (3, 6))
-
- def test_docstring_function(self):
- source = '''
More information about the arch-commits
mailing list