From: Mike Frysinger <vapier@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [PATCH] runtests: rewrite in python
Date: Sat, 30 May 2015 14:27:25 -0400 [thread overview]
Message-ID: <20150530182725.GH2101@vapier> (raw)
In-Reply-To: <20150530101852.7b180cdf.dolsen@gentoo.org>
[-- Attachment #1: Type: text/plain, Size: 2242 bytes --]
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
>
> 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=open("/dev/null", "w"))'
File "<string>", line 1
print("abc", file=open("/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
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 == '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
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-05-30 18:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-30 16:29 [gentoo-portage-dev] [PATCH] runtests: rewrite in python Mike Frysinger
2015-05-30 17:18 ` Brian Dolbec
2015-05-30 18:27 ` Mike Frysinger [this message]
2015-05-30 19:30 ` Brian Dolbec
2015-06-04 4:26 ` Mike Frysinger
2015-06-01 21:16 ` Alexander Berntsen
2015-06-11 7:12 ` Brian Dolbec
2015-05-30 18:42 ` Mike Gilbert
2015-05-30 19:16 ` Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150530182725.GH2101@vapier \
--to=vapier@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox