Switch to Python 3.x
Find and require at least Python 3.5 which will allow us to address
some deprecation warnings, most notably about the 'imp' module.
The major version 3.5 was first released in September 2015 and should
be available in all major distributions, including Ubuntu LTS 16.04 and
18.04 as well as CentOS/RHEL 7.x and 8.x.
Invidivial changes:
https://codereview.appspot.com/545370043
https://codereview.appspot.com/573340043
https://codereview.appspot.com/561270043
Full patch (with Patch Sets)
https://codereview.appspot.com/553420043
Diff:
The switch itself requires 3 changes which I would propose to squash into one commit:
1) Adapt the build system to find and require Python 3.
patch: https://codereview.appspot.com/545370043
2) The largest part of the switch is running 2to3 which is now able to handle the rest of the conversion automatically. For reference, changes for current 'master' are here: https://codereview.appspot.com/573340043
3) Fix-up two places in the scripts afterwards:
3a) Manual changes for compatibility with Python 3, such as removing the call to sys.setdefaultencoding.
3b) Replace cgi.escape by html.escape. While not strictly needed, I think we should include this change because they removed cgi.escape in Python 3.8 after only deprecating it in Python 3.2. The replacement html.escape is only available since that Python 3.2, so we can't do this before switching.
patch: https://codereview.appspot.com/561270043
All of this also available in branch dev/hahnjo/python3 in the repository.
Last edit: Jonas Hahnfeld 2020-01-22
Putting into
newstate to solicit commentsThat is not how it works. "new" generally triggers regression testing, and success of it puts the patch into "review". So to get it to review, you need to set it to "review" (usually the privilege of James) and when James puts it into "countdown", dial that back again to "review". And if it migrates to "push" without ever having seen a regtest, of course dial it back again too. When you are convinced that it passes regtests, "new" is fine. It's your choice then what to do with the eventually resulting "push".
It passes all regtests on my system as explained already in December. So yes, that's exactly what I want.
Not sure what has changed since patch 1 but if I apply patch 2 on a 'clean' master my 'configure' command fails with
Yet (apart from Tidy) I have all this installed.
i.e.
on a clean master I get this
Did you apply all three patches?
https://codereview.appspot.com/545370043
https://codereview.appspot.com/573340043
https://codereview.appspot.com/561270043
I have them in separate Rietveld issues because the second one is actually generated, but as I wrote on lilypond-devel I propose to commit them as one patch.
"Jonas Hahnfeld" hahnjo@users.sourceforge.net writes:
It's usually supposed the other way round: put them into one review (but
as separate diffs, so basically commit by commit) and, if you are fine
with that, as one merge commit with a short branch. Try
git log --graph 5385d029e3e4e89c1a7dba20d3e136f594321816
to get an example for how it looks when done right.
Basically reviews should compile, and so should mainline commits (for
the sake of bisection). If you feel insecure about creating such a
setup (basically the final merge has to be done with --no-ff in order to
actually get a separate merge commit), ask for someone else to do the
push.
--
David Kastrup
David, did you even carefully read my response?!? I'm doing exactly that!
Let me try again:
I have three commits locally: the switch itself, a generated patch by 2to3 and another patch to make it actually work. See above for the three links, with this one being the SF issue to link them.
Now I can put this into one large issue on Rietveld, but you actually don't want to review the second patch. So I have them separate to see the manual changes that do need review. On push, I will fuse them into one commit because a patch won't help with bisection (git bisect might end up picking a commit from the branch that doesn't actually compile).
PS: Sorry if this sounds impolite, but I'm frustrated that I have to explain over and over again.
"Jonas Hahnfeld" hahnjo@users.sourceforge.net writes:
I can sympathise with that.
Let's try a different example: it appears my last example wasn't clear
enough to keep you from reexplaining.
Try
https://sourceforge.net/p/testlilyissues/issues/3815
and its related Rietveld issue
https://codereview.appspot.com/53120044/#ps1
and the commit
git log --graph 809c04e37b8d3d368eda7e4b576e0d80d1934cc3
as another example of a merge commit where the automated conversion run
has been committed to the same Rietveld review as a separate patch
and the whole has been committed as a merge commit in order to have
everything compile well in the mainline.
--
David Kastrup
"Jonas Hahnfeld" hahnjo@users.sourceforge.net writes:
No, you aren't. They are not supposed to be 3 separate Rietveld issues
but a single issue with 2 updates to it.
That's why one puts them into separate updates so that people can select
the diffs to review.
That's why one puts just a merge commit in the mainline. See the
example I gave.
--
David Kastrup
(apparently I can't reply via email, so copy-pasting here)
Am Mittwoch, den 22.01.2020, 13:03 +0000 schrieb David Kastrup:
This means it will be impossible to update the individual commits. But
I can do this if you insist.
This is what I get for
So $ git bisect might pick up an intermediate commit (3dc88bc7db to
703dca1fd6) and ask you to test it. This might work in your example,
but actually not for switching to Python 3.x for the mentioned reasons.
Jonas
"Jonas Hahnfeld" hahnjo@users.sourceforge.net writes:
Indeed. But the fixes on top tend to be small.
It would be a bit hypocritical for me to insist since when digging
through the repository for a useful example, it turned out that almost
all of my merge-structured commits were, after all, mashed into a single
Rietveld review patch. But that's the course if you want to make life
for reviewers simpler in the way you indicated.
It's one use case of Reitveld-based review where our current setup does
not provide a satisfactory workflow.
In my experience, Git travels into non-mainline branches only if it "has
to". I have yet to land in one such side branch, but maybe I have just
been lucky.
--
David Kastrup
Am Mittwoch, den 22.01.2020, 14:00 +0000 schrieb David Kastrup:
Usually yes. But in this scenario I might be forced to re-run 2to3 in the middle of the series if somebody commits a change to any of the touched python files in the mean time.
+1, sadly. On the positive side, this kind of changes with incompatible dependency versions are hopefully rare enough.
Apparently the latter. Not really related to this issue, but I hit this with a constructed example on my first try. In the attached repo,
which is the first commit on branch 'issue' :-(
Diff:
Full patch as requested: https://codereview.appspot.com/553420043
Fails make doc (passes make test-baseline).
I cannot get more information out than this (even with VERBOSE=1)
P.S. I also did the check with the three patches (sorry I didn't see them before) and got the same error. Just in case it was to do with the 'mass patch' you kindly re-did.
You mean
make check? Thetest-baselineshould be with an unpatched master, right?I guess then I'll have to compile a Python 3.6, I tested with 3.5.9, 3.7.? and 3.8.1 so far. The solution for this problem is to call
codecs.open (ps_name, 'r', 'utf-8')but I want to test locally before updating the patch.P.S.: The 'mass patch' should be identical to the combination of the other three.
Unfortunately I can't reproduce this on my system, all of my .eps files are fully ASCII. If you still have a build tree around (not necessarily from this patch), could you run the following?
If this does return files, I need to try replicate your setup (Ubuntu, right?). As I mentioned before, this might solve the issue but I don't see the need yet:
Edit: For completeness,
make docalso passes with Python 3.6.10 for me.Last edit: Jonas Hahnfeld 2020-01-22
Sorry, the command is wrong, it should be
So I indeed have non-ASCII .eps files, but not for the doc build. Let me check again tomorrow.
@lilypond-pkx Unfortunately (or not?) I can't get the failure you were seeing above, it works fine in my VM with Ubuntu 18.04. However I found the whole process to heavily depend on the installed fonts, so maybe your system has more fonts installed than I have. If anything pops to your mind please let me know, otherwise I'm a bit out of ideas right now...