From 63dafb7fad8af66deebaee71af6d7fd78b324cf2 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 26 Aug 2003 17:58:07 +0000 Subject: [PATCH] * python/lilylib.py (command_name): robustification * scripts/lilypond-book.py: idem. * scripts/ly2dvi.py: backport latex redirect fix. --- ChangeLog | 6 ++++++ python/lilylib.py | 4 ++-- scripts/lilypond-book.py | 15 ++++++++++++--- scripts/ly2dvi.py | 5 +++-- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2de0d9aac9..c253c06112 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2003-08-26 Han-Wen Nienhuys + * python/lilylib.py (command_name): robustification + + * scripts/lilypond-book.py: idem. + + * scripts/ly2dvi.py: backport latex redirect fix. + * Documentation/bibliography/engraving.bib (year): typos. 2003-08-25 Han-Wen Nienhuys diff --git a/python/lilylib.py b/python/lilylib.py index f31ecc5130..89104b84e9 100644 --- a/python/lilylib.py +++ b/python/lilylib.py @@ -234,10 +234,10 @@ def setup_temp (): return __main__.temp_dir def command_name (cmd): - return re.match ('^[ \t]*([^ \t]*)', cmd).group (1) + return re.match ('^[^a-z0-9_-]*([a-z0-9_-]*)', cmd).group (1) def error_log (name): - name = re.sub('[/:]','x',name) + name = re.sub('[^a-z]','x',name) return tempfile.mktemp ('%s.errorlog' % name) def read_pipe (cmd, mode = 'r'): diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 1797084fad..5411f8bc3b 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -219,7 +219,7 @@ class LatexPaper: cmd = "latex '\\nonstopmode \input %s'" % fname # Ugh. (La)TeX writes progress and error messages on stdout # Redirect to stderr - cmd += ' 1>/dev/stderr' + cmd = '(( %s >&2 ) >&- )' % cmd status = ly.system (cmd, ignore_error = 1) signal = 0xf & status exit_status = status >> 8 @@ -690,6 +690,7 @@ def compose_full_body (body, opts): } ''' + orig_name = '' for o in opts: m= re.search ('relative(.*)', o) v = 0 @@ -707,7 +708,10 @@ def compose_full_body (body, opts): pitch = pitch + '\'' * v body = '\\relative %s { %s }' % (pitch, body) - + m =re.search ("filename=(.*)", o) + if m: + orig_name = m.group (1) + if is_fragment: body = r''' \score { @@ -731,6 +735,10 @@ def compose_full_body (body, opts): } ''' % (optstring, music_size, linewidth, indent, notime) + body + if orig_name: + body = '\\renameinput \"%s\"\n%s' % (orig_name, body) + + # ughUGH not original options return body @@ -1398,7 +1406,8 @@ def compile_all_files (chunks): cmd = r"latex '\nonstopmode \input %s'" % file # Ugh. (La)TeX writes progress and error messages on stdout # Redirect to stderr - cmd += ' 1>/dev/stderr' + cmd = '(( %s >&2 ) >&- )' % cmd + 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 7d204fc73e..1c5c6208eb 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -492,12 +492,13 @@ None f.close () cmd = latex_cmd + ' \\\\nonstopmode \\\\input %s' % latex_fn + # Ugh. (La)TeX writes progress and error messages on stdout # Redirect to stderr - cmd += ' 1>/dev/stderr' + cmd = '(( %s >&2 ) >&- )' % cmd status = ly.system (cmd, ignore_error = 1) signal = 0xf & status - exit_status = status >> 8 + exit_status = status >> 8 if exit_status: -- 2.39.5