Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
lilypond make check patches
From 0bae5587888cd251a14bd9068658a21fc7ba7ad2 Mon Sep 17 00:00:00 2001
From: Matthew Peveler <matt.peveler@gmail.com>
Date: Mon, 23 Sep 2019 12:18:39 -0300
Subject: [PATCH 1/2] add __lt__ method for py2 old style class sort compat
---
scripts/build/output-distance.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/scripts/build/output-distance.py b/scripts/build/output-distance.py
index f9c73fce0c..925c30ea28 100755
--- a/scripts/build/output-distance.py
+++ b/scripts/build/output-distance.py
@@ -148,6 +148,9 @@ class GrobSignature:
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],
@@ -353,6 +356,9 @@ class FileLink:
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 ()
--
2.23.0
From 4c89360bb48a67cdc222c6c9c5af10f26875b902 Mon Sep 17 00:00:00 2001
From: Matthew Peveler <matt.peveler@gmail.com>
Date: Mon, 23 Sep 2019 12:18:59 -0300
Subject: [PATCH 2/2] read midi files as binary
---
scripts/build/output-distance.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/build/output-distance.py b/scripts/build/output-distance.py
index 925c30ea28..c95e419f37 100755
--- a/scripts/build/output-distance.py
+++ b/scripts/build/output-distance.py
@@ -572,7 +572,8 @@ class MidiFileLink (TextFileCompareLink):
def get_content (self, oldnew):
import midi
- data = FileCompareLink.get_content (self, oldnew)
+ print('reading', oldnew)
+ data = open (oldnew, 'rb').read ()
midi = midi.parse (data)
tracks = midi[1]
--
2.23.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.