]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-book: add a --safe mode option (1281).
authorJulien Rioux <jrioux@physics.utoronto.ca>
Fri, 22 Oct 2010 08:18:49 +0000 (09:18 +0100)
committerGraham Percival <graham@percival-music.ca>
Fri, 22 Oct 2010 08:21:16 +0000 (09:21 +0100)
python/book_snippets.py
scripts/lilypond-book.py

index a19a5796d7e330eb74ab87053791963b6d40450d..a1b1328c575b4be2af6afe92c07d09183b9b1870 100644 (file)
@@ -201,6 +201,8 @@ PREAMBLE_LY = '''%%%% Generated by %(program_name)s
 \layout {
   %(layout_string)s
 }
+
+%(safe_mode_string)s
 '''
 
 
@@ -556,6 +558,10 @@ left-margin-default right-margin-default)"
         notes_string = '\n  '.join (compose_dict[NOTES]) % vars ()
         preamble_string = '\n  '.join (compose_dict[PREAMBLE]) % override
         padding_mm = self.global_options.padding_mm
+        if self.global_options.safe_mode:
+            safe_mode_string = "#(ly:set-option 'safe #t)"
+        else:
+            safe_mode_string = ""
 
         d = globals().copy()
         d.update (locals())
index f8f09966fdf49c1e0b4c135b43302fe4d38252cb..c16abf4a7bb2edc79c2f5a115fd4ec14dd4f4d32 100644 (file)
@@ -179,6 +179,11 @@ def get_option_parser ():
                   action='store',
                   dest='process_cmd', default='')
 
+    p.add_option ('-s', '--safe', help=_ ("Compile snippets in safe mode"),
+                  action="store_true",
+                  default=False,
+                  dest="safe_mode")
+
     p.add_option ('--skip-lily-check',
                   help=_ ("do not fail if no lilypond output is found"),
                   metavar=_ ("DIR"),