]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
Merge branch 'lilypond/translation' of ssh://thsoft@git.sv.gnu.org/srv/git/lilypond...
[lilypond.git] / scripts / lilypond-book.py
index c16abf4a7bb2edc79c2f5a115fd4ec14dd4f4d32..a0501cae9e5c8f0eb9e0584a15456372b64046ac 100644 (file)
@@ -113,7 +113,7 @@ def warranty ():
 
 %s
 %s
-''' % ( _ ('Copyright (c) %s by') % '2001--2010',
+''' % ( _ ('Copyright (c) %s by') % '2001--2011',
         '\n  '.join (authors),
         _ ("Distributed under terms of the GNU General Public License."),
         _ ("It comes with NO WARRANTY.")))
@@ -179,6 +179,11 @@ def get_option_parser ():
                   action='store',
                   dest='process_cmd', default='')
 
+    p.add_option ('--redirect-lilypond-output',
+                  help = _ ("Redirect the lilypond output"),
+                  action='store_true',
+                  dest='redirect_output', default=False)
+
     p.add_option ('-s', '--safe', help=_ ("Compile snippets in safe mode"),
                   action="store_true",
                   default=False,
@@ -347,7 +352,7 @@ def find_toplevel_snippets (input_string, formatter):
 
     return snippets
 
-def system_in_directory (cmd, directory):
+def system_in_directory (cmd, directory, logfile):
     """Execute a command in a different directory.
 
     Because of win32 compatibility, we can't simply use subprocess.
@@ -355,7 +360,10 @@ def system_in_directory (cmd, directory):
 
     current = os.getcwd()
     os.chdir (directory)
-    ly.system(cmd, be_verbose=global_options.verbose,
+    ly.system(cmd,
+              be_verbose=global_options.verbose,
+              redirect_output=global_options.redirect_output,
+              log_file=logfile,
               progress_p=1)
     os.chdir (current)
 
@@ -374,10 +382,12 @@ def process_snippets (cmd, snippets,
                           + list (set ([snip.basename() + '.ly' for snip in snippets])))
     name = os.path.join (lily_output_dir,
                          'snippet-names-%d.ly' % checksum)
+    logfile = name.replace('.ly', '')
     file (name, 'wb').write (contents)
 
     system_in_directory (' '.join ([cmd, ly.mkarg (name)]),
-                         lily_output_dir)
+                         lily_output_dir,
+                         logfile)
 
 
 def snippet_list_checksum (snippets):