Created attachment 376518 [details, diff] tclpython-4.1-r2-python-3.patch Patch for python 3 support. It works for me, not tested properly, possibly contains leaks, and possibly uses not better approaches. I not experienced around python, at all. So if anyone revise this patch, it will be good. I tried to mail to author (Jean-Luc Fontaine), but his e-mail (jfontain@free.fr) blocked due to inactivity. Patch burned in process to use tclpython for interacting with pymorphy2 from tcl. That trying was failed. The pymorphy2 behaviour different under pure python2.7 and under tclpython + python2.7. But with tclpython + python 3 all seems to be okay.
Created attachment 376522 [details] tclpython-4.1-r2.ebuild Ebuild with python 2 and 3 compatibility and with EAPI="5".
Comment on attachment 376522 [details] tclpython-4.1-r2.ebuild --- tclpython-4.1-r2.ebuild 2011-05-30 02:29:56.000000000 +0200 +++ - 2014-05-07 00:29:38.065147146 +0200 @@ -2,10 +2,10 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/dev-tcltk/tclpython/tclpython-4.1-r2.ebuild,v 1.7 2011/05/23 07:17:52 tomka Exp $ -EAPI="3" -PYTHON_DEPEND="2" +EAPI="5" +PYTHON_COMPAT=( python{2_7,3_{2,3}} ) -inherit multilib python toolchain-funcs +inherit eutils multilib python toolchain-funcs DESCRIPTION="Python package for Tcl" HOMEPAGE="http://jfontain.free.fr/tclpython.htm" @@ -20,11 +20,11 @@ RDEPEND="${DEPEND}" pkg_setup() { - python_set_active_version 2 python_pkg_setup } src_compile() { + epatch "${FILESDIR}/tclpython-4.1-r2-python-3.patch" cfile="tclpython tclthread" for src in ${cfile}; do compile="$(tc-getCC) -shared -fPIC ${CFLAGS} -I$(python_get_includedir) -c ${src}.c" @@ -39,10 +39,10 @@ src_install() { insinto /usr/$(get_libdir)/tclpython - doins tclpython.so.${PV} pkgIndex.tcl || die "tcl" + doins tclpython.so.${PV} pkgIndex.tcl fperms 775 /usr/$(get_libdir)/tclpython/tclpython.so.${PV} - dosym tclpython.so.${PV} /usr/$(get_libdir)/tclpython/tclpython.so || die + dosym tclpython.so.${PV} /usr/$(get_libdir)/tclpython/tclpython.so - dodoc CHANGES INSTALL README || die - dohtml tclpython.htm || die + dodoc CHANGES INSTALL README + dohtml tclpython.htm }
+*tclpython-4.1-r3 (26 Oct 2014) + + 26 Oct 2014; Justin Lecher <jlec@gentoo.org> +tclpython-4.1-r3.ebuild, + metadata.xml: + Bump to EAPI=5 and new python eclasses; add py3 support, #509738 +
Justin, thanks for revising the ebuild. You are forget to commit the patch or it requires a some improvements? Tclpython build without it, but works only with python 2. Example (for current main portage tree and python 3.4 eselected as default): $ tclsh % package require tclpython 4 4.1 % set py [python::interp new] python0 % $py exec {print 'python 2 syntax'} python 2 syntax % $py exec {(a, *rest, b) = range(5)} python0: File "<string>", line 1 (a, *rest, b) = range(5) ^ SyntaxError: invalid syntax $ python3 Python 3.4.2 (default, Oct 19 2014, 06:47:18) [GCC 4.8.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> print 'python 2 syntax' File "<stdin>", line 1 print 'python 2 syntax' ^ SyntaxError: Missing parentheses in call to 'print' >>> (a, *rest, b) = range(5) >>> print (rest) [1, 2, 3] >>> Example (for my ebuild with epatch — only added 3_4 to PYTHON_COMPAT): $ tclsh % package require tclpython 4 4.1 % set py [python::interp new] python0 % $py exec {print 'python 2 syntax'} File "<string>", line 1 print 'python 2 syntax' ^ SyntaxError: Missing parentheses in call to 'print' python0: % $py exec {(a, *rest, b) = range(5)} % $py exec {print (rest)} [1, 2, 3]
+*tclpython-4.1-r4 (27 Oct 2014) + + 27 Oct 2014; Justin Lecher <jlec@gentoo.org> -tclpython-4.1-r3.ebuild, + +tclpython-4.1-r4.ebuild, +files/tclpython-4.1-python-3.patch: + Add missing patch, #509738; thanks Alexander Turenko for the backport +
Oh, this patch definitely need more work on it. Main tree ebuild build tclpython, that builds with python 2.7: $ ldd /usr/lib64/tclpython/tclpython.so.4.1 | grep python libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0 (0x00007fe9eb5b9000) My flags: PYTHON_SINGLE_TARGET="python2_7 -python3_3 -python3_4" PYTHON_TARGETS="python2_7 python3_4 -python3_3" For ebuild in attachment 376522 [details] (with 3_4 in PYTHON_COMPAT): $ ldd /usr/lib64/tclpython/tclpython.so.4.1 | grep python libpython3.4.so.1.0 => /usr/lib64/libpython3.4.so.1.0 (0x00007ff20206e000) So, library build works with one version of python. Likely that linking changeable by flags and usable, but not with comfort. I not promise, but maybe I will look deeper into problem and solve it more carefully. Anyway, this bug currently fixed; there is ability to compile tclpython with python 3.
(In reply to Alexander Turenko from comment #6) > Oh, this patch definitely need more work on it. Main tree ebuild build > tclpython, that builds with python 2.7: > > $ ldd /usr/lib64/tclpython/tclpython.so.4.1 | grep python > libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0 (0x00007fe9eb5b9000) > > My flags: PYTHON_SINGLE_TARGET="python2_7 -python3_3 -python3_4" > PYTHON_TARGETS="python2_7 python3_4 -python3_3" > > For ebuild in attachment 376522 [details] (with 3_4 in PYTHON_COMPAT): > > $ ldd /usr/lib64/tclpython/tclpython.so.4.1 | grep python > libpython3.4.so.1.0 => /usr/lib64/libpython3.4.so.1.0 (0x00007ff20206e000) > > So, library build works with one version of python. Likely that linking > changeable by flags and usable, but not with comfort. The problem is that we have no functionality to parallel install librarieslinked against different py ABIs.