From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1NNFPR-0007BN-Sp for garchives@archives.gentoo.org; Wed, 23 Dec 2009 00:49:02 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 98EF7E0883; Wed, 23 Dec 2009 00:48:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 5894FE0883 for ; Wed, 23 Dec 2009 00:48:02 +0000 (UTC) Received: from afta-gentoo.localnet (ip-85-198-235-97.broker.com.pl [85.198.235.97]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id AE40367F8F for ; Wed, 23 Dec 2009 00:48:01 +0000 (UTC) From: Arfrever Frehtes Taifersar Arahesis To: Gentoo Development Subject: Re: [gentoo-dev] Versioning of Python scripts Date: Wed, 23 Dec 2009 01:50:57 +0100 User-Agent: KMail/1.12.4 (Linux/2.6.32-tuxonice-AFTA; KDE/4.3.4; x86_64; ; ) References: <200912191624.55244.Arfrever@gentoo.org> <20091221105014.GA6292@hrair> In-Reply-To: <20091221105014.GA6292@hrair> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart3014103.iJ1ghoFge6"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200912230151.04357.Arfrever@gentoo.org> X-Archives-Salt: 80b4a858-2abf-4684-802a-7f5d1b2d71b9 X-Archives-Hash: 0f608402fcc3bf1ce18d60fdb2fcd608 --nextPart3014103.iJ1ghoFge6 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 2009-12-21 11:50:14 Brian Harring napisa=C5=82(a): > On Sat, Dec 19, 2009 at 04:24:49PM +0100, Arfrever Frehtes Taifersar Arah= esis wrote: > > Distutils/Setuptools/Distribute modify shebangs of installed Python scr= ipts, so that they > > contain path of Python interpreter with version included (e.g. "#!/usr/= bin/python3.2"). > > This behavior has both advantage and disadvantages: > > - Scripts of packages supporting only e.g. Python 2 can be executed (= without necessity > > of using of e.g. "python2 /usr/bin/${script}") after activating of = e.g. Python 3. > > - Scripts of packages supporting multiple Python versions ignore acti= ve Python version. > > - Scripts of packages supporting multiple Python versions cannot be e= asily (without > > necessity of using of e.g. "python3.1 /usr/bin/${script}") executed= with a Python > > version different than active Python version. > > The best solution, which removes these 2 disadvantages and preserves th= e advantage, seems > > to be to rename Python scripts to include Python version [1] in filenam= es, and create wrapper > > scripts, which call appropriate target scripts [2]. Some files sometime= s try to execute > > e.g. "/usr/bin/python /usr/bin/${script}", so wrapper scripts must be i= mplemented in Python. > > Wrapper scripts try to execute "${wrapper_script}-${PYTHON_ABI}" files = (e.g. "py.test" will > > execute "py.test-3.1", when Python 3.1 is set as active Python version). > >=20 > > distutils.eclass will automatically rename some scripts [3] in "${D}usr= /bin" and call > > the function, which generates wrapper scripts. In case somebody is inte= rested in reading of > > source code of python_generate_wrapper_scripts() function and potential= suggesting of > > improvements, I'm attaching this function and 2 example wrapper scripts= =2E I'm planning to > > commit addition of this function in next week. >=20 > Not really a huge fan of the EPYTHON var... can you clarify it's real=20 > world usage? It simplifies development of ebuilds of packages having non-Distutils-based= build systems. E.g. ebuilds of packages, which support only Python2, install some executab= les or libraries (e.g. /usr/lib/kvirc/4.0/modules/libkvipythoncore.so of net-irc/kvirc) link= ed against libpythonX.Y.so and don't install any Python modules, will be able to simpl= y call 'python_set_active_version 2', which will export EPYTHON variable with appr= opriate value. Ebuilds should never manually set EPYTHON variable. > I can see that causing all sorts of mayhem as it passes=20 > it's way down through python scripts invoking other scripts-=20 > specifically thinking of a py3k only script being forced to 3.1, then=20 > invoking a py2k script. EPYTHON variable should be respected only by scripts, which are used during= building, testing or installation of other packages and need to be called with appropriate Py= thon version. Examples: py.test, trial distutils_src_install() will call python_generate_wrapper_scripts() (at lea= st by default) without -E option. > Beyond that, please provide a way to *disable* this for a pkg. OK. =2D-=20 Arfrever Frehtes Taifersar Arahesis --nextPart3014103.iJ1ghoFge6 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iQIcBAABAgAGBQJLMWl4AAoJEFtpjAED8H0YeMUQAOPlqYD24pvCdflE34yFUgOJ CoPTvqzXl6x06QVAh6a7jSFAcNVcgbUvwBV6Qnfk8/shkTtKCCniBDj9BpRwV8qP KCwy5+oxe6oqtkX2Zdf8P3fx5rr3hFuEaCgX9z7aaOvyRDjhShkD07ZeUkFIQyy4 xoNd2qeulKcj8J1vKySK1LTvUV+uZ4Vko5pMEZFJeJR0DETOLQyEnRpH8Yb7bMHz 65KXiXDJHudsWh2wqiFNiLt6Ln82ebn+Pf+YAS88EFChpYJUMnLwUa9hnXe3WqnK r+uNLD7jfpnA8m1eTZ/CEJMqCYa0+M/k7VMx/6B8dBIMyBASUbI4hGO8TqAtwSfX YmdsMvOFv0hYZbMd0hS5mhSYxTAP/S0GFh51RSekrzd2WP4NSOtQ1y/z+Yni83nT DvdYtOxYbKT2pVvNmZUxW9zzY+CXeWuELHIliGfOP/OWFBF+OSw/9QJ+lNKJJVUA rRkVkDbtHZbZbMYKKa+nVzcfEABb/YjBueNKC+lxT2FO16xmBXJTktmpkxLSNQf6 uF04W8teu99YHPqX+N+cXDgKX30qEEk4mis6zZUrBfTLcSgUmkf44ybWEri6Xk0s UHXOSzKvMP/XRsXsaSvpTERgrWNJbht5BvRwEF8HD4JeWvImM2OMOuxOlzDhTsvJ SggysJGEpj0JclJD1XTa =CGJh -----END PGP SIGNATURE----- --nextPart3014103.iJ1ghoFge6--