]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/lilylib.py
Run grand replace for 2015.
[lilypond.git] / python / lilylib.py
index 8aaa57ab8bc24ce5d10a8e0d8cc174f121b9445f..a911cac23f0a2f8bdc77503a0e0c886becc7fa6f 100644 (file)
@@ -1,6 +1,6 @@
 # This file is part of LilyPond, the GNU music typesetter.
 #
-# Copyright (C) 1998--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
+# Copyright (C) 1998--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
 #                Jan Nieuwenhuizen <janneke@gnu.org>
 #
 # LilyPond is free software: you can redistribute it and/or modify
@@ -335,8 +335,15 @@ class NonDentedHeadingFormatter (optparse.IndentedHelpFormatter):
     def format_description(self, description):
         return description
 
+class NonEmptyOptionParser (optparse.OptionParser):
+    "A subclass of OptionParser that gobbles empty string arguments."
+
+    def parse_args (self, args=None, values=None):
+        options, args = optparse.OptionParser.parse_args (self, args, values)
+        return options, filter (None, args)
+
 def get_option_parser (*args, **kwargs):
-    p = optparse.OptionParser (*args, **kwargs)
+    p = NonEmptyOptionParser (*args, **kwargs)
     p.formatter = NonDentedHeadingFormatter ()
     p.formatter.set_parser (p)
     return p