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 F2BB01389E2 for ; Sun, 28 Dec 2014 12:00:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9368FE0AE3; Sun, 28 Dec 2014 12:00:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C28AEE0AE3 for ; Sun, 28 Dec 2014 12:00:45 +0000 (UTC) Received: from pomiot.lan (mgorny-1-pt.tunnel.tserv28.waw1.ipv6.he.net [IPv6:2001:470:70:353::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id D21DE340554; Sun, 28 Dec 2014 12:00:43 +0000 (UTC) Date: Sun, 28 Dec 2014 13:00:38 +0100 From: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= To: gentoo-python Subject: Re: [gentoo-python] RFC: Redesign for 'best implementation' in python-r1 Message-ID: <20141228130038.424a89d9@pomiot.lan> In-Reply-To: <20141227145043.63b3731e@pomiot.lan> References: <20141227145043.63b3731e@pomiot.lan> Organization: Gentoo X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; 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-sha512; boundary="Sig_/8VFKqgOS8f/cIynMcZmCVg/"; protocol="application/pgp-signature" X-Archives-Salt: d9215ed7-cc73-4af7-bb75-414a3fc6969a X-Archives-Hash: 717fc63ee7e890c2677876ba63d55e33 --Sig_/8VFKqgOS8f/cIynMcZmCVg/ Content-Type: multipart/mixed; boundary="MP_/QRfQ.LPo3EjqytY.YutaO7H" --MP_/QRfQ.LPo3EjqytY.YutaO7H Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Dnia 2014-12-27, o godz. 14:50:43 Micha=C5=82 G=C3=B3rny napisa=C5=82(a): > 2. python_setup changes API to: >=20 > python_setup [...] >=20 > alike python_gen_* functions, defaulting to '*'. Now it chooses > the best impl from implementations matching the specified patterns, > e.g.: >=20 > python_setup 'python2*' >=20 > would get the best version of CPython 2. Patch for this one attached. --=20 Best regards, Micha=C5=82 G=C3=B3rny --MP_/QRfQ.LPo3EjqytY.YutaO7H Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=python-r1.eclass.diff Index: python-r1.eclass =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v retrieving revision 1.81 diff -u -B -r1.81 python-r1.eclass --- python-r1.eclass 28 Dec 2014 10:56:55 -0000 1.81 +++ python-r1.eclass 28 Dec 2014 12:00:02 -0000 @@ -737,17 +737,56 @@ } =20 # @FUNCTION: python_setup +# @USAGE: [...] # @DESCRIPTION: -# Find the best (most preferred) Python implementation enabled -# and set the Python build environment up for it. +# Find the best (most preferred) Python implementation that is enabled +# and matches at least one of the patterns passed (or '*' if no patterns +# passed). Set the Python build environment up for that implementation. # # This function needs to be used when Python is being called outside # of python_foreach_impl calls (e.g. for shared processes like doc # building). python_foreach_impl sets up the build environment itself. +# +# If the specific commands support only a subset of Python +# implementations, patterns need to be passed to restrict the allowed +# implementations. +# +# Example: +# @CODE +# DEPEND=3D"doc? ( dev-python/epydoc[$(python_gen_usedep 'python2*')] )" +# +# src_compile() { +# #... +# if use doc; then +# python_setup 'python2*' +# make doc +# fi +# } +# @CODE python_setup() { debug-print-function ${FUNCNAME} "${@}" =20 - python_export_best + local best_impl patterns=3D( "${@-*}" ) + _python_try_impl() { + local pattern + for pattern in "${patterns[@]}"; do + if [[ ${EPYTHON} =3D=3D ${pattern} ]]; then + best_impl=3D${EPYTHON} + fi + done + } + python_foreach_impl _python_try_impl + + if [[ ! ${best_impl} ]]; then + eerror "${FUNCNAME}: none of the enabled implementation matched the patt= erns." + eerror " patterns: ${@-'(*)'}" + eerror "Likely a REQUIRED_USE constraint (possibly USE-conditional) is m= issing." + eerror " suggested: || ( \$(python_gen_useflags ${@}) )" + eerror "(remember to quote all the patterns with '')" + die "${FUNCNAME}: no enabled implementation satisfy requirements" + fi + + python_export "${best_impl}" EPYTHON PYTHON python_wrapper_setup } =20 --MP_/QRfQ.LPo3EjqytY.YutaO7H-- --Sig_/8VFKqgOS8f/cIynMcZmCVg/ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQJ8BAEBCgBmBQJUn/DmXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2REJCMDdDQzRGMERBRDA2RUEwQUZFNDFC MDdBMUFFQUVGQjQ0NjRFAAoJELB6GurvtEZOtQcQAJkfoEL7iZP85RMTFffP8R8b aLe+qJLlMq6L52GbHRB6nE+fKxA5ZpjZr0umpDYTlWU3uomajprj+ABkJSJ0jYk8 7s29etlBcRpldu2Xt5cOzhZjxGm6sOpZnMfOiq+TSSJsyLiBw7sWZVKBx3/2bwRz 3EkoFyGYf5FKlMmCx1v5Uc4wXzFwrDMDYXWMd/c0fhsqmJZsryzBY0XCXGRDN7BW oEB+u6O47odovMqnyZk6LzWgasqzhUv+UwDigO0WIL+UN9jYjbBv5KZmGBeva/mz 6sYiXYYajcOVkA0Fhjv1unydb/chvVEKNMw2cxcB4JSDeRnpXvJfjr2AgZGHAw3r gXSJip5gRgUCRzBwVeSrHv7QJrvn6pmFScrk/uwAPvxvMIGARSt58TGk/gVm7juo NxBE5vrNH3DcTH+BJ0mYtkftekPAXOl6XXwzU/yw6RZagiioDtiEPZLinzPkU41H 83UnBLUuUj78+yp3eiC4fMszlDxAkBSoKlz7kgw5Jf521StPihe3w7sJjhWmsDVN BYqweTs+nYnMToAQ1xmDhHQ7meatWzg5uLVLEsCJA2Yj+DvYlkSunDs0xzhqyLGC ecszuHLoOLHrxj54+HxfBvT9tFT2qm6grsItxNjx53eHMeOvvHWDFhyPzrEdrljW uy7zae7SyJjupcgf0y0y =cCGK -----END PGP SIGNATURE----- --Sig_/8VFKqgOS8f/cIynMcZmCVg/--