diff options
author | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2010-12-24 23:33:06 +0000 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2010-12-24 23:33:06 +0000 |
commit | 75009477d86f54a0ccf1e31dd639698e879cddb7 (patch) | |
tree | 5623d40785d010f25bb4ffad78416b9d148e434f /dev-python/cython | |
parent | Delete older ebuild. (diff) | |
download | gentoo-2-75009477d86f54a0ccf1e31dd639698e879cddb7.tar.gz gentoo-2-75009477d86f54a0ccf1e31dd639698e879cddb7.tar.bz2 gentoo-2-75009477d86f54a0ccf1e31dd639698e879cddb7.zip |
Fix compatibility with Python 3. Fix handling of __new__().
(Portage version: 2.2.0_alpha10_p5/cvs/Linux x86_64)
Diffstat (limited to 'dev-python/cython')
-rw-r--r-- | dev-python/cython/ChangeLog | 9 | ||||
-rw-r--r-- | dev-python/cython/cython-0.14-r1.ebuild | 60 | ||||
-rw-r--r-- | dev-python/cython/files/cython-0.14-__new__.patch | 26 | ||||
-rw-r--r-- | dev-python/cython/files/cython-0.14-python-3.patch | 37 |
4 files changed, 131 insertions, 1 deletions
diff --git a/dev-python/cython/ChangeLog b/dev-python/cython/ChangeLog index ffe00864dda8..1a2518a750bf 100644 --- a/dev-python/cython/ChangeLog +++ b/dev-python/cython/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for dev-python/cython # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/cython/ChangeLog,v 1.58 2010/12/15 12:11:06 arfrever Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-python/cython/ChangeLog,v 1.59 2010/12/24 23:33:06 arfrever Exp $ + +*cython-0.14-r1 (24 Dec 2010) + + 24 Dec 2010; Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> + -cython-0.14.ebuild, +cython-0.14-r1.ebuild, + +files/cython-0.14-__new__.patch, +files/cython-0.14-python-3.patch: + Fix compatibility with Python 3. Fix handling of __new__(). *cython-0.14 (15 Dec 2010) diff --git a/dev-python/cython/cython-0.14-r1.ebuild b/dev-python/cython/cython-0.14-r1.ebuild new file mode 100644 index 000000000000..933735649596 --- /dev/null +++ b/dev-python/cython/cython-0.14-r1.ebuild @@ -0,0 +1,60 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/cython/cython-0.14-r1.ebuild,v 1.1 2010/12/24 23:33:06 arfrever Exp $ + +EAPI="3" +SUPPORT_PYTHON_ABIS="1" +RESTRICT_PYTHON_ABIS="*-jython" + +inherit distutils eutils + +MY_PN="Cython" +MY_P="${MY_PN}-${PV/_/.}" + +DESCRIPTION="The Cython compiler for writing C extensions for the Python language" +HOMEPAGE="http://www.cython.org/ http://pypi.python.org/pypi/Cython" +SRC_URI="http://www.cython.org/release/${MY_P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~x64-solaris ~x86-solaris" +IUSE="doc examples" + +DEPEND="" +RDEPEND="" + +S="${WORKDIR}/${MY_P}" + +PYTHON_CFLAGS=("2.* + -fno-strict-aliasing") + +DOCS="README.txt ToDo.txt USAGE.txt" +PYTHON_MODNAME="Cython cython.py pyximport" + +src_prepare() { + distutils_src_prepare + + epatch "${FILESDIR}/${P}-python-3.patch" + epatch "${FILESDIR}/${P}-__new__.patch" +} + +src_test() { + testing() { + rm -fr BUILD + "$(PYTHON)" runtests.py -vv + } + python_execute_function testing +} + +src_install() { + distutils_src_install + + if use doc; then + # "-A c" is for ignoring of "Doc/primes.c". + dohtml -A c -r Doc/* || die "Installation of documentation failed" + fi + + if use examples; then + insinto /usr/share/doc/${PF}/examples + doins -r Demos/* || die "Installation of examples failed" + fi +} diff --git a/dev-python/cython/files/cython-0.14-__new__.patch b/dev-python/cython/files/cython-0.14-__new__.patch new file mode 100644 index 000000000000..4a794a2c9c7a --- /dev/null +++ b/dev-python/cython/files/cython-0.14-__new__.patch @@ -0,0 +1,26 @@ +https://github.com/cython/cython/commit/e3c9a78686b7a7f0d36da8e6189b1e1fb4037c73 + +--- Cython/Compiler/Nodes.py ++++ Cython/Compiler/Nodes.py +@@ -1988,7 +1988,7 @@ + # staticmethod() was overridden - not much we can do here ... + self.is_staticmethod = False + +- if self.name == '__new__': ++ if self.name == '__new__' and env.is_py_class_scope: + self.is_staticmethod = 1 + + self.analyse_argument_types(env) +--- Cython/Compiler/Symtab.py ++++ Cython/Compiler/Symtab.py +@@ -1535,9 +1535,8 @@ + if name in ('__eq__', '__ne__', '__lt__', '__gt__', '__le__', '__ge__'): + error(pos, "Special method %s must be implemented via __richcmp__" % name) + if name == "__new__": +- warning(pos, "__new__ method of extension type will change semantics " ++ error(pos, "__new__ method of extension type will change semantics " + "in a future version of Pyrex and Cython. Use __cinit__ instead.") +- name = EncodedString("__cinit__") + entry = self.declare_var(name, py_object_type, pos, visibility='extern') + special_sig = get_special_method_signature(name) + if special_sig: diff --git a/dev-python/cython/files/cython-0.14-python-3.patch b/dev-python/cython/files/cython-0.14-python-3.patch new file mode 100644 index 000000000000..b5cde11fa189 --- /dev/null +++ b/dev-python/cython/files/cython-0.14-python-3.patch @@ -0,0 +1,37 @@ +https://github.com/cython/cython/commit/b1f7f744b338e97753b5da24037f98397dc751db + +--- Cython/Build/Inline.py ++++ Cython/Build/Inline.py +@@ -52,9 +52,12 @@ + symbol_collector = AllSymbols() + symbol_collector(tree) + unbound = [] +- import __builtin__ ++ try: ++ import builtins ++ except ImportError: ++ import __builtin__ as builtins + for name in symbol_collector.names: +- if not tree.scope.lookup(name) and not hasattr(__builtin__, name): ++ if not tree.scope.lookup(name) and not hasattr(builtins, name): + unbound.append(name) + return unbound + +@@ -79,7 +82,7 @@ + return 'numpy.ndarray[numpy.%s_t, ndim=%s]' % (arg.dtype.name, arg.ndim) + else: + for base_type in py_type.mro(): +- if base_type.__module__ == '__builtin__': ++ if base_type.__module__ in ('__builtin__', 'builtins'): + return 'object' + module = context.find_module(base_type.__module__, need_pxd=False) + if module: +@@ -125,7 +128,7 @@ + arg_names.sort() + arg_sigs = tuple([(get_type(kwds[arg], ctx), arg) for arg in arg_names]) + key = code, arg_sigs, sys.version_info, sys.executable, Cython.__version__ +- module_name = "_cython_inline_" + hashlib.md5(str(key)).hexdigest() ++ module_name = "_cython_inline_" + hashlib.md5(str(key).encode('utf-8')).hexdigest() + try: + if not os.path.exists(lib_dir): + os.makedirs(lib_dir) |