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 14A7D138CD0 for ; Sat, 30 May 2015 18:27:32 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BC74DE08B0; Sat, 30 May 2015 18:27:28 +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 1BB33E0895 for ; Sat, 30 May 2015 18:27:27 +0000 (UTC) Received: from vapier (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with SMTP id 8BFF9340CA1 for ; Sat, 30 May 2015 18:27:26 +0000 (UTC) Date: Sat, 30 May 2015 14:27:25 -0400 From: Mike Frysinger To: gentoo-portage-dev@lists.gentoo.org Subject: Re: [gentoo-portage-dev] [PATCH] runtests: rewrite in python Message-ID: <20150530182725.GH2101@vapier> Mail-Followup-To: gentoo-portage-dev@lists.gentoo.org References: <1433003354-18413-1-git-send-email-vapier@gentoo.org> <20150530101852.7b180cdf.dolsen@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="aFi3jz1oiPowsTUB" Content-Disposition: inline In-Reply-To: <20150530101852.7b180cdf.dolsen@gentoo.org> X-Archives-Salt: 8ae43310-6842-422a-a8f9-79be6bb11088 X-Archives-Hash: 00156fd183e513c507f2a07a1b5f09cb --aFi3jz1oiPowsTUB Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 30 May 2015 10:18, Brian Dolbec wrote: > On Sat, 30 May 2015 12:29:14 -0400 Mike Frysinger wrote: > > +from __future__ import print_function >=20 > If I'm not mistaken, this is not needed for 2.7+ anymore. It is > still for 2.6 though. i believe you're mistaken :) $ python2.7 -c 'print "abc"' abc $ python2.7 -c 'print("abc", file=3Dopen("/dev/null", "w"))' File "", line 1 print("abc", file=3Dopen("/dev/null", "w")) ^ SyntaxError: invalid syntax don't be fooled by the naive case: $ python2.7 -c 'print("abc")' abc that's just parens around a string and since it's a single item, it's not a= =20 tuple, just a string. if you were to add more, it's more obvious: $ python2.7 -c 'print("abc", "ddd")' ('abc', 'ddd') > > +def get_python_executable(ver): > > + """Find the right python executable for |ver|""" > > + if ver =3D=3D 'pypy': > > + prog =3D 'pypy' > > + else: > > + prog =3D 'python' + ver > > + return os.path.join(EPREFIX, 'usr', 'bin', prog) >=20 >=20 > The only thing I don't like about this is it could mean more > maintenance changes in the future if others come along. to be clear: this is not new code. this is (more or less) a straight port = =66rom=20 bash to python. your feedback here applies to the bash version as well. i= 'd=20 like to minimize the changes when converting languages and then address=20 feedback like this on top of that. > I think making the lists have more complete naming would be better >=20 > PYTHON_SUPPORTED_VERSIONS =3D [ > 'python2.7', > 'python3.3', > 'python3.4', > ] >=20 > # The rest are just "nice to have". > PYTHON_NICE_VERSIONS =3D [ > 'pypy', > 'python3.5', > 'foo-bar-7.6', > ] >=20 > Then all that is needed in get_python_executable() is the final path. > No other future code changes are likely to be needed. > Also easier to override from the environment without editing code. this makes the command line interface a bit more annoying. today you can d= o: $ runtests --python-version '2.7 3.3' but with this change, it'd be: $ runtests --python-version 'python2.7 python3.3' we could add some logic so that if the arg is composed of dots & digits, we= 'd=20 blindly prefix it with "python". -mike --aFi3jz1oiPowsTUB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVagENAAoJEEFjO5/oN/WBYwwP/1pa3zshptWPD56XJkJfjJ55 IMFPqh+cfknDlufbIXVoETIJW/w+xPdQP/zKiABJFVHZzHT+JRP4DUIlt5eZK+q0 uuA+U9eKMpj2A8mGJZcavsG0MUKTXHGjyr8TnOl0uBKiEgWKfxdsTc2OH1MRvdvP dziIT02KEYIVr2L4yrxk1qtqOaITpwObrq8MedtMHVkqr0E0SMAIPDa81OHAYu38 Uwfl0hzjaZWhPyimb8ZhbMQsHAp0TQ+rw5TkS5fMCDe2P57VXRy0hSm1FKD77K+C 5SCVFt2QNLrAW4JIVNzadIwFxLYgXImHtwMdjhtZz7UpXYGttThgZBaJzsszl3Hl paTu+mPvOV+mi8GP/QrHCl94UqmFdC8v4QU7JkWq2U28KHU5qWRG3KFSQ4k43ZAh oHeMODDnluspTDyGHv+txvLgH28dFscjT2y775v/TLdXt4ycvsmgAt6dyy+SdMJ+ jZRT7tY8D8GEzWlDSYsKoVgRODe9voMo+NWu9cXvvpjbjWt1/1i3huj0VE4e8dPg 3zt1zA11vQnKKKAxzGubWMogpfCMG5x3U02cC5h7ULE1fk8rJHqRkCv76Dcu/wXM vM915xq/LL32et0hD1qL6luIqYOOER/Fsvd5qIwPFr4/KHP8XBMYUb6PPZpdD6Tb mNLyhm0fBfd8eK4Rig4t =4jxh -----END PGP SIGNATURE----- --aFi3jz1oiPowsTUB--