From 9dafb20273dda7e62b0b8f03651bb5204fc7360f Mon Sep 17 00:00:00 2001
From: Stefan Weil <sw@weilnetz.de>
Date: Fri, 8 Oct 2021 08:10:55 +0200
Subject: [PATCH] Fix TypeError on MacOS when lilypond was not found
This fixes a runtime error on MacOS when a user tries to build a preview
and the Lilypond installation was not found.
Traceback (most recent call last):
[...]
File "/Applications/Frescobaldi.app/Contents/Resources/lib/python3.9/frescobaldi_app/signals.py", line 308, in call
File "/Applications/Frescobaldi.app/Contents/Resources/lib/python3.9/frescobaldi_app/cachedproperty.py", line 264, in checkstart
File "/Applications/Frescobaldi.app/Contents/Resources/lib/python3.9/frescobaldi_app/cachedproperty.py", line 276, in run
File "/Applications/Frescobaldi.app/Contents/Resources/lib/python3.9/frescobaldi_app/lilypondinfo.py", line 306, in frommacports
TypeError: unsupported operand type(s) for +: 'bool' and 'str'
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
frescobaldi_app/lilypondinfo.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/frescobaldi_app/lilypondinfo.py b/frescobaldi_app/lilypondinfo.py
index 931c9bb56..868715348 100644
--- a/frescobaldi_app/lilypondinfo.py
+++ b/frescobaldi_app/lilypondinfo.py
@@ -301,7 +301,8 @@ def done():
@CachedProperty.cachedproperty(depends=(abscommand, bindir))
def frommacports(self):
"""Return True if this LilyPond is provided by MacPorts."""
- if sys.platform.startswith('darwin'):
+ bindir = self.bindir()
+ if sys.platform.startswith('darwin') and bindir:
import subprocess
portbin = os.path.abspath(self.bindir() + '/port')
if os.path.isfile(portbin) and os.access(portbin, os.X_OK):