From: Jan Nieuwenhuizen Date: Mon, 4 Nov 2002 21:37:33 +0000 (+0000) Subject: * scripts/lilypond-book.py: X-Git-Tag: release/1.7.7~24 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=dae90eeb2c4f141a455c0a08f5cf214f4386aac0;p=lilypond.git * scripts/lilypond-book.py: * scripts/ly2dvi.py: Fix: redirect latex progress/error output to stderr (by default this goes to stdout). Show lilypond progress, even when not verbose. * python/lilylib.py (system): New optional parameter to control showing of progress. --- diff --git a/ChangeLog b/ChangeLog index 8af30925da..2d262a647d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,12 @@ 2002-11-04 Jan Nieuwenhuizen + * scripts/lilypond-book.py: * scripts/ly2dvi.py: Fix: redirect latex progress/error output to stderr (by default this goes to stdout). Show lilypond progress, - even when not verbose. Ugh. + even when not verbose. + + * python/lilylib.py (system): New optional parameter to control + showing of progress. * scm/backend-documentation-lib.scm (check-dangling-properties): Fix error message. diff --git a/python/lilylib.py b/python/lilylib.py index f929cd3bad..d9250f0807 100644 --- a/python/lilylib.py +++ b/python/lilylib.py @@ -241,10 +241,10 @@ def read_pipe (cmd, mode = 'r'): progress ('\n') return output -def system (cmd, ignore_error = 0): +def system (cmd, ignore_error = 0, progress_p = 0): - ''' Run CMD. If IGNORE_ERROR is set, do not complain when CMD -returns non zero. + '''System CMD. If IGNORE_ERROR, do not complain when CMD +returns non zero. If PROGRESS_P, always show progress. RETURN VALUE @@ -252,27 +252,30 @@ Exit status of CMD ''' name = command_name (cmd) - redirect = '' if __main__.verbose_p: + progress_p = 1 progress (_ ("Invoking `%s\'") % cmd) - if __main__.pseudo_filter_p: - redirect = ' 1> /dev/null' else: progress ( _("Running %s...") % name) - redirect = ' 1> /dev/null 2>%s' % error_log (name) + redirect = '' + if not progress_p: + redirect = ' 1>/dev/null 2>' + error_log (name) + elif __main__.pseudo_filter_p: + redirect = ' 1>/dev/null' + status = os.system (cmd + redirect) signal = 0x0f & status exit_status = status >> 8 if status: - msg = _ ("`%s\' failed (%d)") % (name, status / exit_status) + msg = _ ("`%s\' failed (%d)") % (name, exit_status) if ignore_error: if __main__.verbose_p: warning (msg + ' ' + _ ("(ignored)")) else: error (msg) - if not __main__.verbose_p: + if not progress_p: error (_ ("The error log is as follows:")) sys.stderr.write (open (error_log (name)).read ()) exit (status) diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index b0be30e7ae..38f4a51fd2 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -171,6 +171,9 @@ class LatexPaper: re_dim = re.compile (r"\\(\w+)\s+(\d+\.\d+)") cmd = "latex '\\nonstopmode \input %s'" % fname + # Ugh. (La)TeX writes progress and error messages on stdout + # Redirect to stderr + cmd += ' 1>/dev/stderr' status = ly.system (cmd, ignore_error = 1) signal = 0xf & status exit_status = status >> 8 @@ -1112,7 +1115,7 @@ def compile_all_files (chunks): texfiles = string.join (tex) cmd = string.join ((lilypond_cmd, lilyopts, g_extra_opts, texfiles)) - ly.system (cmd) + ly.system (cmd, ignore_error = 0, progress_p = 1) # # Ugh, fixing up dependencies for .tex generation @@ -1132,7 +1135,11 @@ def compile_all_files (chunks): f.close () def to_eps (file): - ly.system (r"latex '\nonstopmode \input %s'" % file) + cmd = r"latex '\nonstopmode \input %s'" % file + # Ugh. (La)TeX writes progress and error messages on stdout + # Redirect to stderr + cmd += ' 1>/dev/stderr' + ly.system (cmd) ly.system ("dvips -E -o %s.eps %s" % (file, file)) map (to_eps, eps) diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index 95be3e4910..814783e872 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -246,16 +246,7 @@ def run_lilypond (files, dep_prefix): ly.print_environment () cmd = string.join ((lilypond_cmd,opts, fs)) - - # We set verbose, because we always want to see lily's - # progess on stderr - save_verbose = verbose_p - - # Ugh, this gives ugly full Invoking ... command - verbose_p = 1 - status = ly.system (cmd, ignore_error = 1) - verbose_p = save_verbose - + status = ly.system (cmd, ignore_error = 1, progress_p = 1) signal = 0x0f & status exit_status = status >> 8