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 249C4138CD0 for ; Sat, 30 May 2015 19:30:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8DBBDE08E2; Sat, 30 May 2015 19:30:10 +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 1C9E3E08E1 for ; Sat, 30 May 2015 19:30:10 +0000 (UTC) Received: from big_daddy.dol-sen.ca (S010634bdfa9ecf80.vc.shawcable.net [96.49.31.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dolsen) by smtp.gentoo.org (Postfix) with ESMTPSA id 476E13409A6 for ; Sat, 30 May 2015 19:30:09 +0000 (UTC) Date: Sat, 30 May 2015 12:30:06 -0700 From: Brian Dolbec To: gentoo-portage-dev@lists.gentoo.org Subject: Re: [gentoo-portage-dev] [PATCH] runtests: rewrite in python Message-ID: <20150530123006.3aa8110c.dolsen@gentoo.org> In-Reply-To: <20150530182725.GH2101@vapier> References: <1433003354-18413-1-git-send-email-vapier@gentoo.org> <20150530101852.7b180cdf.dolsen@gentoo.org> <20150530182725.GH2101@vapier> Organization: Gentoo 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: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archives-Salt: bd827722-f60c-4120-9002-8e4f9a76c928 X-Archives-Hash: 242e8f3a36dbea7a8bcc0384dd0c4cdb On Sat, 30 May 2015 14:27:25 -0400 Mike Frysinger wrote: > > > > +def get_python_executable(ver): > > > + """Find the right python executable for |ver|""" > > > + if ver == 'pypy': > > > + prog = 'pypy' > > > + else: > > > + prog = 'python' + ver > > > + return os.path.join(EPREFIX, 'usr', 'bin', prog) > > > > > > 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 from bash to python. your feedback here applies to the bash > version as well. i'd like to minimize the changes when converting > languages and then address feedback like this on top of that. > > > I think making the lists have more complete naming would be better > > > > PYTHON_SUPPORTED_VERSIONS = [ > > 'python2.7', > > 'python3.3', > > 'python3.4', > > ] > > > > # The rest are just "nice to have". > > PYTHON_NICE_VERSIONS = [ > > 'pypy', > > 'python3.5', > > 'foo-bar-7.6', > > ] > > > > 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 do: $ 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 blindly prefix it with "python". > -mike Well, that get's back to almost the same kind of get_python_executable(). But I think it would be a little better than the existing. We could instead do a string search and include any member with that substring. That would include python3.3 and foo-bar-3.3 for a 3.3 cli entry. It could make for a more flexible cli versions = [] for y in args.python_versions: versions.extend([x for x in all_pythons if y in x]) -- Brian Dolbec