[arch-commits] Commit in python-astroid/repos/testing-any (PKGBUILD python-3.4.patch)

Felix Yan fyan at nymeria.archlinux.org
Sat Mar 22 16:57:18 UTC 2014


    Date: Saturday, March 22, 2014 @ 17:57:18
  Author: fyan
Revision: 208335

archrelease: copy trunk to testing-any

Added:
  python-astroid/repos/testing-any/python-3.4.patch
    (from rev 208334, python-astroid/trunk/python-3.4.patch)
Deleted:
  python-astroid/repos/testing-any/PKGBUILD

------------------+
 PKGBUILD         |   50 -------------------------
 python-3.4.patch |  104 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 104 insertions(+), 50 deletions(-)

Deleted: PKGBUILD
===================================================================
--- PKGBUILD	2014-03-22 16:55:18 UTC (rev 208334)
+++ PKGBUILD	2014-03-22 16:57:18 UTC (rev 208335)
@@ -1,50 +0,0 @@
-# $Id$
-# Maintainer: Angel Velasquez <angvp at archlinux.org> 
-
-pkgbase=python-astroid
-pkgname=('python2-astroid' 'python-astroid')
-pkgver=1.0.1
-pkgrel=2
-pkgdesc="Useful miscellaneous modules used by Logilab projects"
-arch=('any')
-url="http://www.logilab.org/project/logilab-common"
-license=('LGPL')
-makedepends=('python2' 'python')
-source=(https://pypi.python.org/packages/source/a/astroid/astroid-${pkgver}.tar.gz)
-sha1sums=('4b0080576174cc0a3519a6c6e9025a8ee853956a')
-
-build() {
-  cd "${srcdir}"
-
-  cp -a astroid-${pkgver}{,-py3}
-
-  cd astroid-${pkgver}
-  python2 setup.py build
-
-  cd ../astroid-${pkgver}-py3
-  python3 setup.py build
-}
-
-package_python2-astroid() {
-  depends=('python2' 'python2-logilab-common')
-  replaces=('python2-logilab-astng')
-  conflicts=('python2-logilab-astng')
-  cd "${srcdir}"/astroid-${pkgver}
-
-  python2 setup.py install --optimize=1 --skip-build --prefix=/usr --root="${pkgdir}"
-
-  # fix permissions ...
-  find "${pkgdir}" -type f -exec chmod +r {} \;
-}
-
-package_python-astroid() {
-  depends=('python' 'python-logilab-common')
-  replaces=('python-logilab-astng')
-  conflicts=('python-logilab-astng')
-  cd "${srcdir}"/astroid-${pkgver}-py3
-
-  python3 setup.py install --optimize=1 --skip-build --prefix=/usr --root="${pkgdir}"
-
-  # fix permissions ...
-  find "${pkgdir}" -type f -exec chmod +r {} \;
-}

Copied: python-astroid/repos/testing-any/python-3.4.patch (from rev 208334, python-astroid/trunk/python-3.4.patch)
===================================================================
--- python-3.4.patch	                        (rev 0)
+++ python-3.4.patch	2014-03-22 16:57:18 UTC (rev 208335)
@@ -0,0 +1,104 @@
+diff --git a/rebuilder.py b/rebuilder.py
+--- a/rebuilder.py
++++ b/rebuilder.py
+@@ -88,6 +88,8 @@
+             'Repr': 'Backquote',
+             }
+
++PY34 = sys.version_info >= (3, 4)
++
+ def _init_set_doc(node, newnode):
+     newnode.doc = None
+     try:
+@@ -187,13 +188,20 @@
+         newnode.defaults = [self.visit(child, newnode) for child in node.defaults]
+         newnode.kwonlyargs = []
+         newnode.kw_defaults = []
+-        newnode.vararg = node.vararg
+-        newnode.kwarg = node.kwarg
++        vararg, kwarg = node.vararg, node.kwarg
++        # change added in 82732 (7c5c678e4164), vararg and kwarg
++        # are instances of `_ast.arg`, not strings
++        if vararg and PY34:
++            vararg = vararg.arg
++        if kwarg and PY34:
++            kwarg = kwarg.arg
++        newnode.vararg = vararg
++        newnode.kwarg = kwarg
+         # save argument names in locals:
+-        if node.vararg:
+-            newnode.parent.set_local(newnode.vararg, newnode)
+-        if node.kwarg:
+-            newnode.parent.set_local(newnode.kwarg, newnode)
++        if vararg:
++            newnode.parent.set_local(vararg, newnode)
++        if kwarg:
++            newnode.parent.set_local(kwarg, newnode)
+         newnode.set_line_info(newnode.last_child())
+         return newnode
+ 
+@@ -838,6 +846,12 @@
+         # XXX or we should instead introduce a Arg node in astroid ?
+         return self.visit_assname(node, parent, node.arg)
+ 
++    def visit_nameconstant(self, node, parent):
++        # in Python 3.4 we have NameConstant for True / False / None
++        newnode = new.Const(node.value)
++        _set_infos(node, newnode, parent)
++        return newnode
++
+     def visit_arguments(self, node, parent):
+         newnode = super(TreeRebuilder3k, self).visit_arguments(node, parent)
+         self.asscontext = "Ass"
+diff --git a/test/unittest_inference.py b/test/unittest_inference.py
+--- a/test/unittest_inference.py
++++ b/test/unittest_inference.py
+@@ -52,6 +52,11 @@
+ else:
+     EXC_MODULE = BUILTINS
+ 
++if sys.version_info < (3, 4):
++    SITE = 'site'
++else:
++    SITE = '_sitebuiltins'
++
+ class InferenceTC(TestCase):
+ 
+     CODE = '''
+@@ -700,7 +705,7 @@
+         self.assertEqual(len(infered), 1, infered)
+         self.assertIsInstance(infered[0], Instance)
+         self.assertEqual(str(infered[0]),
+-                             'Instance of site._Helper')
++                             'Instance of %s._Helper' % SITE)
+ 
+     def test_builtin_open(self):
+         code = '''
+diff --git a/test/unittest_regrtest.py b/test/unittest_regrtest.py
+--- a/test/unittest_regrtest.py
++++ b/test/unittest_regrtest.py
+@@ -16,7 +16,7 @@
+ # You should have received a copy of the GNU Lesser General Public License along
+ # with astroid. If not, see <http://www.gnu.org/licenses/>.
+ 
+-from logilab.common.testlib import unittest_main, TestCase
++from logilab.common.testlib import unittest_main, TestCase, require_version
+ 
+ from astroid import ResolveError, MANAGER, Instance, nodes, YES, InferenceError
+ from astroid.builder import AstroidBuilder
+@@ -135,6 +135,15 @@
+         self.assertEqual(len(infered), 1)
+         self.assertIsInstance(infered[0], Instance)
+ 
++    @require_version('3.0')
++    def test_nameconstant(self):
++        # used to fail for Python 3.4
++        builder = AstroidBuilder()
++        astroid = builder.string_build("def test(x=True): pass")
++        default = astroid.body[0].args.args[0]
++        self.assertEqual(default.name, 'x')
++        self.assertEqual(next(default.infer()).value, True)
++
+ 
+ class Whatever(object):
+     a = property(lambda x: x, lambda x: x)




More information about the arch-commits mailing list