From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 34A11138010 for ; Wed, 31 Oct 2012 09:17:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D021A21C006; Wed, 31 Oct 2012 09:17:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D4F0221C006 for ; Wed, 31 Oct 2012 09:17:08 +0000 (UTC) Received: from pomiocik.lan (213-238-96-169.adsl.inetia.pl [213.238.96.169]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 67B0533D872; Wed, 31 Oct 2012 09:17:07 +0000 (UTC) Date: Wed, 31 Oct 2012 10:17:56 +0100 From: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= To: gentoo-python@lists.gentoo.org Subject: [gentoo-python] Replacing python-wrapper with python-exec Message-ID: <20121031101756.21b8a92a@pomiocik.lan> Organization: Gentoo X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.13; x86_64-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Discussions centering around the Python ecosystem in Gentoo Linux X-BeenThere: gentoo-python@gentoo.org X-BeenThere: gentoo-python@lists.gentoo.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA256; boundary="Sig_/gS/N4JtQBNi8r+fjo2ba9U3"; protocol="application/pgp-signature" X-Archives-Salt: 3c4f9fb9-52ed-4d20-bb0d-e0bae518c08f X-Archives-Hash: 6a214f86ffa0a2419610f9ebfd2aef5f --Sig_/gS/N4JtQBNi8r+fjo2ba9U3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello, Now that python-exec spawns random Python scripts happily, I think we can consider replacing python-wrapper (the one that spawns Python itself) with it as well. The idea is similar, and the code is much simpler here. However, a bit of hackery would need to be done to change python-exec's behavior. Right now, it spawns "$0-$EPYTHON" but it will need to just spawn "$EPYTHON" when run as 'python'. I think we can do it in one of the following ways: 1) add an 'if' clause to the code, looking for argv[0]~=3Dpython. Simply saying, if python-exec is run as python, just run $EPYTHON, without prepending $0-. As simple as it can be. Pros: - a simple solution. Cons: - potentially fragile -- check relies on argv[0]; someone symlinks it to a different name -- boom; - the 'if' check done for every other script where it is irrelevant. 2) add '-$EPYTHON' symlinks to the python interpreters. So: /usr/bin/python-python2.7 -> python2.7 /usr/bin/python-python2.6 -> python2.6 /usr/bin/python-pypy-c1.9 -> pypy-c1.9 Pros: - will work with python-exec as-is. Cons: - $PATH pollution. Note: if we ever wanted to replace Python implementations with additional wrappers (e.g. trying to fix bug #438984[1]) the 'long names' could carry the actual Python executables. But that's probably a bad idea anyway. [1]:https://bugs.gentoo.org/show_bug.cgi?id=3D438984 3) add an '#if' clause and build the Python-relevant code conditionally. In other words, let python-exec install both regular 'python-exec' and the 'python' binary built from the same code with '#if' switched. Pros: - still simple, and clean. Cons: - two executables installed. What are your thoughts? --=20 Best regards, Micha=C5=82 G=C3=B3rny --Sig_/gS/N4JtQBNi8r+fjo2ba9U3 Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iJwEAQEIAAYFAlCQ7MUACgkQfXuS5UK5QB3TMQQAskSS70Ry1BqAOFj+5jynLOhE /+7SqQTvd/1bSwFB06YnXPGroEpmKBePyRw75x+QtbaXXesBHLRHd/LzzXf+5Oyd yyccYy13P9mJ2FM458rp2Zx0dxjs9CDPc+HXGyn1cyArYC7w6LlTUufWagFNh4+B Ha9XQtpxvFNHOhWnqLk= =x8lw -----END PGP SIGNATURE----- --Sig_/gS/N4JtQBNi8r+fjo2ba9U3--