]> git.donarmstrong.com Git - lilypond.git/commitdiff
* python/lilylib.py (command_name): robustification
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 26 Aug 2003 17:58:07 +0000 (17:58 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 26 Aug 2003 17:58:07 +0000 (17:58 +0000)
* scripts/lilypond-book.py: idem.

* scripts/ly2dvi.py: backport latex redirect fix.

ChangeLog
python/lilylib.py
scripts/lilypond-book.py
scripts/ly2dvi.py

index 2de0d9aac93c2a905a30445fc378698301041217..c253c06112ffd7fb4f47c94f00bae7e9da56f844 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2003-08-26  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
+       * 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  <hanwen@cs.uu.nl>
index f31ecc5130848aff85d5b9e06b18f65b9a586f25..89104b84e9aa2a4e41e9d525718ae7f27bb0f0f0 100644 (file)
@@ -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'):
index 1797084fadc926fc128bdec25efa4e6cc91f2c0f..5411f8bc3b1f2ef8af9c87775d5f297cdd01c770 100644 (file)
@@ -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)
index 7d204fc73e1b2066bfa5628a1082c9702d73f186..1c5c6208ebd2888fe4055f8eeb4f24d4794ea9d1 100644 (file)
@@ -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: