From: Graham Percival Date: Tue, 30 Aug 2011 03:53:11 +0000 (+0100) Subject: lys-to-tely.py: add --glob-input= X-Git-Tag: release/2.15.9-1~5^2~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e18a8f4c4bc2f583b330715a03f9b8b5feb26b4d;p=lilypond.git lys-to-tely.py: add --glob-input= This will let us avoid the "too many arguments" without needing to sepcify all names on the command-line. --- diff --git a/scripts/build/lys-to-tely.py b/scripts/build/lys-to-tely.py index a911e02aa2..6a2a05ed7d 100644 --- a/scripts/build/lys-to-tely.py +++ b/scripts/build/lys-to-tely.py @@ -14,6 +14,7 @@ import sys import os import getopt import re +import glob program_name = 'lys-to-tely' @@ -28,6 +29,7 @@ Options: options -o, --output=NAME write tely doc to NAME -i, --input-filenames=NAME read list of files from a file instead of stdin + -g, --glob-input=GLOB a string which will be passed to glob.glob(GLOB) -t, --title=TITLE set tely doc title TITLE -a, --author=AUTHOR set tely author AUTHOR --template=TEMPLATE use TEMPLATE as Texinfo template file, @@ -43,12 +45,13 @@ def help (text): (options, files) = getopt.getopt (sys.argv[1:], 'f:hn:t:', ['fragment-options=', 'help', 'name=', 'title=', 'author=', 'template=', - 'input-filenames=']) + 'input-filenames=', 'glob-input=']) name = "ly-doc" title = "Ly Doc" author = "Han-Wen Nienhuys and Jan Nieuwenhuizen" input_filename = "" +glob_input = "" template = '''\input texinfo @setfilename %%(name)s.info @settitle %%(title)s @@ -90,6 +93,8 @@ for opt in options: author = a elif o == '-i' or o == '--input-filenames': input_filename = a + elif o == '-p' or o == '--glob-input': + glob_input = a elif o == '-f' or o == '--fragment-options': fragment_options = a elif o == '--template': @@ -143,7 +148,9 @@ def name2line (n): """ % (os.path.basename (n), fragment_options, n) return s -if input_filename: +if glob_input: + files = glob.glob(glob_input) +elif input_filename: files = open(input_filename).read().splitlines() if files: