def get_lilypond_bin_path(self):
config = configparser.SafeConfigParser()
lily_cfgfile = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'config', 'lilypond.cfg')
config.read(lily_cfgfile)
# check custom
lilypath = config.get('custom', 'custom')
# linux path might be given with $HOME; convert it to the real path
lilypath = lilypath.replace('$HOME', os.path.expanduser('~'))
if lilypath:
assert os.path.exists(lilypath), \
'The lilypond path is not found. Please correct the custom ' \
'section in "tomato/config/lilypond.cfg".'
else: # defaults
lilypath = config.defaults()[self.sys_os]
assert (os.path.exists(lilypath) or
self.call('"which" "{0:s}"'.format(lilypath))[0]), \
'The lilypond path is not found. Please correct the custom ' \
'section in "tomato/config/lilypond.cfg".'
return lilypath
评论列表
文章目录