]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
Merge branch 'master' into lilypond/translation
[lilypond.git] / scripts / lilypond-book.py
index 832cea0c6292ad1f77a79f2d6dda7337ab39d3f3..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"),
@@ -487,6 +492,7 @@ def samefile (f1, f2):
 
 def do_file (input_filename, included=False):
     # Ugh.
+    input_absname = input_filename
     if not input_filename or input_filename == '-':
         in_handle = sys.stdin
         input_fullname = '<stdin>'
@@ -499,7 +505,7 @@ def do_file (input_filename, included=False):
         # Otherwise, "lilypond-book -o out test.tex" will complain that it is
         # overwriting the input file (which it is actually not), since the
         # input filename is relative to the CWD...
-        input_fullname = os.path.abspath (input_fullname)
+        input_absname = os.path.abspath (input_fullname)
 
         note_input_file (input_fullname)
         in_handle = file (input_fullname)
@@ -526,7 +532,7 @@ def do_file (input_filename, included=False):
                                    input_base + global_options.formatter.default_extension)
     if (os.path.exists (input_filename)
         and os.path.exists (output_filename)
-        and samefile (output_filename, input_fullname)):
+        and samefile (output_filename, input_absname)):
      error (
      _ ("Output would overwrite input file; use --output."))
      exit (2)