]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
Merge branch 'master' into lilypond/translation
[lilypond.git] / scripts / lilypond-book.py
index 78e9130b07b46be46df4c1fcfb6f3f637220db34..395551ca0519f7fea206f9e62f461676be763615 100644 (file)
@@ -96,13 +96,12 @@ def exit (i):
     else:
         sys.exit (i)
 
-def identify ():
-    ly.encoded_write (sys.stdout, '%s (GNU LilyPond) %s\n' % (ly.program_name, ly.program_version))
-
 progress = ly.progress
 warning = ly.warning
 error = ly.error
 
+def identify ():
+    progress('%s (GNU LilyPond) %s' % (ly.program_name, ly.program_version))
 
 def warranty ():
     identify ()
@@ -113,7 +112,7 @@ def warranty ():
 
 %s
 %s
-''' % ( _ ('Copyright (c) %s by') % '2001--2011',
+''' % ( _ ('Copyright (c) %s by') % '2001--2012',
         '\n  '.join (authors),
         _ ("Distributed under terms of the GNU General Public License."),
         _ ("It comes with NO WARRANTY.")))
@@ -143,7 +142,7 @@ def get_option_parser ():
     p.add_option ("-I", '--include', help=_ ("add DIR to include path"),
                   metavar=_ ("DIR"),
                   action='append', dest='include_path',
-                  default=[os.path.abspath (os.getcwd ())])
+                  default=[])
 
     p.add_option ('--info-images-dir',
                   help=_ ("format Texinfo output so that Info will "
@@ -456,11 +455,9 @@ def do_process_cmd (chunks, input_name, options):
     progress (_ ("Writing snippets..."))
     for snippet in outdated:
         snippet.write_ly()
-    progress ('\n')
 
     if outdated:
         progress (_ ("Processing..."))
-        progress ('\n')
         process_snippets (options.process_cmd, outdated,
                           options.formatter, options.lily_output_dir)
 
@@ -474,8 +471,6 @@ def do_process_cmd (chunks, input_name, options):
                                            output_files,
                                            options.output_dir)
 
-    progress ('\n')
-
 
 ###
 # Format guessing data
@@ -496,7 +491,6 @@ def write_if_updated (file_name, lines):
         new_str = ''.join (lines)
         if oldstr == new_str:
             progress (_ ("%s is up to date.") % file_name)
-            progress ('\n')
 
             # this prevents make from always rerunning lilypond-book:
             # output file must be touched in order to be up to date
@@ -511,7 +505,6 @@ def write_if_updated (file_name, lines):
 
     progress (_ ("Writing `%s'...") % file_name)
     file (file_name, 'w').writelines (lines)
-    progress ('\n')
 
 
 def note_input_file (name, inputs=[]):
@@ -577,7 +570,6 @@ def do_file (input_filename, included=False):
     try:
         progress (_ ("Reading %s...") % input_fullname)
         source = in_handle.read ()
-        progress ('\n')
 
         if not included:
             global_options.formatter.init_default_snippet_options (source)
@@ -588,7 +580,6 @@ def do_file (input_filename, included=False):
 
         # Let the formatter modify the chunks before further processing
         chunks = global_options.formatter.process_chunks (chunks)
-        progress ('\n')
 
         if global_options.filter_cmd:
             write_if_updated (output_filename,
@@ -596,7 +587,6 @@ def do_file (input_filename, included=False):
         elif global_options.process_cmd:
             do_process_cmd (chunks, input_fullname, global_options)
             progress (_ ("Compiling %s...") % output_filename)
-            progress ('\n')
             write_if_updated (output_filename,
                      [s.replacement_text ()
                      for s in chunks])
@@ -605,7 +595,6 @@ def do_file (input_filename, included=False):
             os.chdir (original_dir)
             name = snippet.substring ('filename')
             progress (_ ("Processing include: %s") % name)
-            progress ('\n')
             return do_file (name, included=True)
 
         include_chunks = map (process_include,
@@ -617,7 +606,6 @@ def do_file (input_filename, included=False):
     except BookSnippet.CompileError:
         os.chdir (original_dir)
         progress (_ ("Removing `%s'") % output_filename)
-        progress ('\n')
         raise BookSnippet.CompileError
 
 def do_options ():
@@ -627,8 +615,7 @@ def do_options ():
     (global_options, args) = opt_parser.parse_args ()
 
     global_options.information = {'program_version': ly.program_version, 'program_name': ly.program_name }
-
-    global_options.include_path =  map (os.path.abspath, global_options.include_path)
+    global_options.original_dir = original_dir
 
     # Load the python packages (containing e.g. custom formatter classes)
     # passed on the command line
@@ -678,7 +665,7 @@ def main ():
         if global_options.lily_output_dir:
             # This must be first, so lilypond prefers to read .ly
             # files in the other lybookdb dir.
-            includes = [os.path.abspath(global_options.lily_output_dir)] + includes
+            includes = [global_options.lily_output_dir] + includes
         global_options.process_cmd += ' '.join ([' -I %s' % ly.mkarg (p)
                                                  for p in includes])
 
@@ -724,7 +711,7 @@ def main ():
                      base_file_name + global_options.formatter.default_extension)
 
     os.chdir (original_dir)
-    file (dep_file, 'w').write ('%s: %s'
+    file (dep_file, 'w').write ('%s: %s\n'
                                 % (final_output_file, ' '.join (inputs)))
 
 if __name__ == '__main__':