2002-11-04 Jan Nieuwenhuizen <janneke@gnu.org>
+ * 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.
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
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)
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
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
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)
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