Browse Source

Test for lilypond compiler before starting compilation

pull/169/head
Oliverpool 9 years ago
parent
commit
1da076773d
  1. 17
      patacrep/build.py

17
patacrep/build.py

@ -123,6 +123,9 @@ class Songbook(object):
renderer.render_tex(output, config) renderer.render_tex(output, config)
def requires_lilypond(self):
return 'lilypond' in self.config.get('bookoptions', [])
def _log_pipe(pipe): def _log_pipe(pipe):
"""Log content from `pipe`.""" """Log content from `pipe`."""
while 1: while 1:
@ -227,6 +230,20 @@ class SongbookBuilder(object):
except Exception as error: except Exception as error:
raise errors.ExecutableNotFound(compiler) raise errors.ExecutableNotFound(compiler)
# Test if lilypond compiler is accessible
lilypond_compiler = 'lilypond'
if self.songbook.requires_lilypond():
try:
check_call(
[lilypond_compiler, "--version"],
stdin=PIPE,
stdout=PIPE,
stderr=PIPE,
universal_newlines=True,
)
except Exception as error:
raise errors.ExecutableNotFound(lilypond_compiler)
# Perform compilation # Perform compilation
try: try:
process = Popen( process = Popen(

Loading…
Cancel
Save