]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
Don't let lyrics interfere with StaffGrouper.
[lilypond.git] / scripts / lilypond-book.py
index aafce6d2be78224d11faccf890e95b4a9ca2c828..674878c3fa60a20c9091d65ffd2014a180bbb607 100644 (file)
@@ -51,6 +51,7 @@ import re
 import stat
 import sys
 import tempfile
+import imp
 from optparse import OptionGroup
 
 
@@ -163,6 +164,11 @@ def get_option_parser ():
                   action='store', dest='lily_output_dir',
                   default=None)
 
+    p.add_option ('--load-custom-package', help=_ ("Load the additional python PACKAGE (containing e.g. a custom output format)"),
+                  metavar=_ ("PACKAGE"),
+                  action='append', dest='custom_packages',
+                  default=[])
+
     p.add_option ("-o", '--output', help=_ ("write output to DIR"),
                   metavar=_ ("DIR"),
                   action='store', dest='output_dir',
@@ -577,6 +583,14 @@ def do_options ():
 
     global_options.include_path =  map (os.path.abspath, global_options.include_path)
 
+    # Load the python packages (containing e.g. custom formatter classes)
+    # passed on the command line
+    nr = 0
+    for i in global_options.custom_packages:
+        nr += 1
+        print imp.load_source ("book_custom_package%s" % nr, i)
+
+
     if global_options.warranty:
         warranty ()
         exit (0)