On Thu, Jan 05, 2017 at 12:23:29PM +0100, Andrea Bolognani wrote:
On Thu, 2017-01-05 at 10:54 +0100, Martin Kletzander wrote:
> > Yeah, I'm not great at Python.
>
> Oh, so that's why there's not print(), just sys.stdout.write()... =)
AFAIK Python 2's print statement and Python 3's print()
function are not entirely comparable, eg. there's no obvious
way to use print to display a string that's already
newline-terminated without Python adding one extra newline
and still have the code run on both major Python versions,
whereas sys.stdout.write() doesn't have the same issue.
I could be entirely wrong though :)
You are not. This is solved by "from __future__ import print_function"
which makes the print work as in python3. What I find totally baffling
is that we use python2's statement and even though I have python3 as
default, it doesn't fail. Even if I use --with-python=python3, we still
have PYTHON=python2 in the Makefiles. I'm totally not in the mood for
finding out the cause as I'm currently dealing with yet another
unexplainable problem I'm facing and I'm getting exhausted pretty
quickly.
sys.*.write is perfectly fine
> I'm not going to comment on the python style, for me it's
enough that it
> works now, it can be made more python-ish later on.
Works for me ;)
[...]
> > +NEWS: $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml
$(srcdir)/docs/reformat-news.py
>
> This ^^ and
>
> > + $(AM_V_GEN) \
> > + if [ -x $(XSLTPROC) ]; then \
> > + $(XSLTPROC) --nonet $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml
>$@-tmp \
>
> ^^ this fails (. Do you even) syntax-check.
I quite clearly didn't. Will fix.
--
Andrea Bolognani / Red Hat / Virtualization