]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
Issue 3623: lilypond-book fails with file names containing shell-special characters
[lilypond.git] / scripts / lilypond-book.py
index 6d424a18521c289991723363c7f04381dc8e042c..8dea1fc1a795623d446582a690a4c625f9918f18 100644 (file)
@@ -277,6 +277,11 @@ if 'bindir' in globals () and bindir:
 if '@bindir@' == ('@' + 'bindir@') or not os.path.exists (lilypond_binary):
     lilypond_binary = 'lilypond'
 
+# Need to shell-quote, issue 3468
+
+import pipes
+lilypond_binary = pipes.quote (lilypond_binary)
+
 global_options = None
 
 
@@ -438,7 +443,10 @@ def split_output_files(directory):
     Return value is a set of strings.
     """
     files = []
-    for subdir in glob.glob (os.path.join (directory, '[a-f0-9][a-f0-9]')):
+    def globquote(x):
+        return re.sub ("[][*?]", r"[\g<0>]", x)
+    for subdir in glob.glob (os.path.join (globquote (directory),
+                                           '[a-f0-9][a-f0-9]')):
         base_subdir = os.path.split (subdir)[1]
         sub_files = [os.path.join (base_subdir, name)
                      for name in os.listdir (subdir)]