You are right, that was added in my original debug effort. Attached is the
second patch without the added print. It looks like the files are getting
stored as `.bin` files, though are just plain text when you open them. If
someone could explain to me the proper way to attach patches here (or maybe
it's just gmail being funny?), I would appreciate it.

I'll have another email later on with patches for having this branch run
under both python2.7 & 3 as the necessary backport efforts were not really
all that extravagant with just a handful of shims around the changes you
noted in long vs int, unicode vs str, StringIO vs io, iter.next vs
iter.__next__, reload, xrange vs range. The primary thing missing is making
the stepmake/stepmake/python-module-*.make files work for the range of
versions, but I'm afraid that is out of my wheel house of ability.

Matt

On Thu, Sep 26, 2019 at 6:03 AM Jonas Hahnfeld <hah...@hahnjo.de> wrote:

> Am Montag, den 23.09.2019, 12:26 -0300 schrieb Matthew Peveler:
> > On Sat, Sep 21, 2019 at 5:52 AM Jonas Hahnfeld via lilypond-devel <
> lilypond-devel@gnu.org> wrote:
> > > On top of that I've worked on the attached patches which brings the
> make targets check / test and doc back to life with Python 3.7.4.
> >
> > In applying your patches and running "make check", I encountered a
> couple of errors in scripts/build/output-distance.py, which would be summed
> up as:
> >
> > 1. Python 2 old style classes had a default __cmp__ which would compare
> the id() of the classes, and used implicitly for sort. Python 3 removed
> this, but need to define a __lt__ method for sort compat.
> > 2. attempting to open midi files as str files, though they are filled
> with binary data (and python/midi.py seems to expect binary in interacting
> with the contents).
> >
> > Please see the attached for small patches for these two things, and got
> "make check" to run for me using Python 3.7.4 as well.
> >
> > Regards,
> > Matt
>
> Ha, I already wondered why there are two targets check and test that
> both ran into the same issues (when I started). Turns out, the target
> "check" runs "test" but not the other way around, and I only verified
> that "test" works in the end...
>
> The patches make sense to me and also work on my system. You should
> probably remove the print() statement in the second patch, though.
>
> Thanks,
> Jonas
>
From 298f17d82948335b98ffcf2feb9c14c80ddad390 Mon Sep 17 00:00:00 2001
From: Matthew Peveler <matt.peveler@gmail.com>
Date: Mon, 23 Sep 2019 06:15:27 -0300
Subject: [PATCH 2/2] Fix py3 compat issues in output_distance.py

---
 scripts/build/output-distance.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/build/output-distance.py b/scripts/build/output-distance.py
index 83999e4559..7e31959ee4 100755
--- a/scripts/build/output-distance.py
+++ b/scripts/build/output-distance.py
@@ -150,6 +150,9 @@ class GrobSignature(object):
         self.bbox = (bbox_x, bbox_y)
         self.centroid = (bbox_x[0] + bbox_x[1], bbox_y[0] + bbox_y[1])
 
+    def __lt__ (self, other):
+        return id(self) < id(other)
+
     def __repr__ (self):
         return '%s: (%.2f,%.2f), (%.2f,%.2f)\n' % (self.name,
                                                    self.bbox[0][0],
@@ -355,6 +358,9 @@ class FileLink(object):
         self._distance = None
         self.file_names = (f1, f2)
 
+    def __lt__ (self, other):
+        return id(self) < id(other)
+
     def text_record_string (self):
         return '%-30f %-20s\n' % (self.distance (),
                                   self.name ()
@@ -568,7 +574,7 @@ class MidiFileLink (TextFileCompareLink):
     def get_content (self, oldnew):
         import midi
 
-        data = FileCompareLink.get_content (self, oldnew)
+        data = open (oldnew, 'rb').read ()
         midi = midi.parse (data)
         tracks = midi[1]
 
@@ -1381,4 +1387,3 @@ def main ():
 
 if __name__ == '__main__':
     main ()
-
-- 
2.23.0

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to