From 0960f475b89981a7568e9fc629f93c983c0cf5d0 Mon Sep 17 00:00:00 2001 From: Phil Holmes Date: Fri, 6 May 2011 15:06:36 +0100 Subject: [PATCH] Add a -q quiet flag to 'make website' scripts --- Documentation/lilypond-texi2html.init | 2 +- make/website.make | 24 ++++++++++++++++++++++++ scripts/build/bib2texi.py | 18 ++++++++++++++---- scripts/build/extract_texi_filenames.py | 17 ++++++++++++----- scripts/build/mass-link.py | 2 -- 5 files changed, 51 insertions(+), 12 deletions(-) diff --git a/Documentation/lilypond-texi2html.init b/Documentation/lilypond-texi2html.init index 0b542ed777..1e75f54aa7 100644 --- a/Documentation/lilypond-texi2html.init +++ b/Documentation/lilypond-texi2html.init @@ -847,7 +847,7 @@ $Texi2HTML::Config::DOCTYPE = ' "lilypond-website.css", TITLE => "Default style"} diff --git a/make/website.make b/make/website.make index 5c0528aec9..55e2331633 100644 --- a/make/website.make +++ b/make/website.make @@ -4,6 +4,7 @@ ################################################################ ##### SECURITY -- check these values for lilypond.org ######### ################################################################ + ifeq ($(WEBSITE_ONLY_BUILD),1) ### for lilypond.org TOP_SRC_DIR=$(HOME)/lilypond/lilypond-git @@ -30,6 +31,25 @@ else PICTURES=Documentation/pictures/out-www endif +################################################################ +#The 4 lines below present an option to force make website to run +# quietly only when it is run as make -s website. However, we've +# decided not to use this switch, and run the scripts quietly all +# the time +################################################################ +#quiet-run = $(findstring s, $(MAKEFLAGS)) +#ifeq ($(quiet-run),s) +# quiet-flag=-q +#endif + +#Nothing clever here - just allows the use of a boolean to control +# quiet running +quiet-run = true +ifeq ($(quiet-run),true) + quiet-flag=-q +endif + + ################################################################ OUT=out-website @@ -69,6 +89,7 @@ website-xrefs: website-version -I $(top-src-dir)/Documentation/"$$l" \ -I $(OUT) -o $(OUT) --split=node \ --known-missing-files=$(top-src-dir)/scripts/build/website-known-missing-files.txt \ + $(quiet-flag) \ $(top-src-dir)/Documentation/"$$l"/web.texi ;\ for m in $(MANUALS); do \ n=`echo "$$m" | sed 's/Documentation/Documentation\/'$$l'/'` ; \ @@ -80,6 +101,7 @@ website-xrefs: website-version -I $(top-src-dir)/Documentation/"$$l" \ -I $(top-src-dir)/Documentation/"$$l"/"$$d" \ --known-missing-files=$(top-src-dir)/scripts/build/website-known-missing-files.txt \ + $(quiet-flag) \ -I $(OUT) -o $(OUT) "$$n" ; \ fi ; \ done; \ @@ -90,11 +112,13 @@ website-bibs: website-version $(WEB_BIBS) -s web \ -s $(top-src-dir)/Documentation/lily-bib \ -o $(OUT)/others-did.itexi \ + $(quiet-flag) \ $(top-src-dir)/Documentation/web/others-did.bib BSTINPUTS=$(top-src-dir)/Documentation/web \ $(WEB_BIBS) -s web \ -s $(top-src-dir)/Documentation/lily-bib \ -o $(OUT)/we-wrote.itexi \ + $(quiet-flag) \ $(top-src-dir)/Documentation/web/we-wrote.bib diff --git a/scripts/build/bib2texi.py b/scripts/build/bib2texi.py index dd896fa8b0..ab8a6b902b 100644 --- a/scripts/build/bib2texi.py +++ b/scripts/build/bib2texi.py @@ -6,12 +6,14 @@ import tempfile # usage: def usage (): - print 'usage: %s [-s style] [-o ] BIBFILES...' + print 'usage: %s [-s style] [-o ] [-q] BIBFILES...' + print '-q suppresses most output' -(options, files) = getopt.getopt (sys.argv[1:], 's:o:', []) +(options, files) = getopt.getopt (sys.argv[1:], 's:o:hq', []) output = 'bib.itexi' style = 'long' +show_output = True for (o,a) in options: if o == '-h' or o == '--help': @@ -21,6 +23,8 @@ for (o,a) in options: style = a elif o == '-o' or o == '--output': output = a + elif o == '-q': + show_output = False else: raise Exception ('unknown option: %s' % o) @@ -55,10 +59,16 @@ open (tmpfile + '.aux', 'w').write (r''' tmpdir = tempfile.gettempdir () +if (show_output): + quiet_flag = '' +else: + quiet_flag = ' -terse ' + #The command line to invoke bibtex -cmd = "TEXMFOUTPUT=%s bibtex %s" % (tmpdir, tmpfile) +cmd = "TEXMFOUTPUT=%s bibtex %s %s" % (tmpdir, quiet_flag, tmpfile) -sys.stdout.write ("Invoking `%s'\n" % cmd) +if (show_output): + sys.stdout.write ("Running bibtex on %s\n" % files) #And invoke it stat = os.system (cmd) if stat <> 0: diff --git a/scripts/build/extract_texi_filenames.py b/scripts/build/extract_texi_filenames.py index fcb464d53d..33a31b7af5 100644 --- a/scripts/build/extract_texi_filenames.py +++ b/scripts/build/extract_texi_filenames.py @@ -34,11 +34,12 @@ import re import os import getopt -options_list, files = getopt.getopt (sys.argv[1:],'o:s:hI:m:', +options_list, files = getopt.getopt (sys.argv[1:],'o:s:hI:m:k:q', ['output=', 'split=', 'help', 'include=', 'master-map-file=', - 'known-missing-files=']) + 'known-missing-files=', + 'quiet']) help_text = r"""Usage: %(program_name)s [OPTIONS]... TEXIFILE... Extract files names for texinfo (sub)sections from the texinfo files. @@ -50,8 +51,9 @@ Options: -o, --output=DIRECTORY write .xref-map files to DIRECTORY -s, --split=MODE split manual according to MODE. Possible values are section and custom (default) - --known-missing-files a filename which has a list of files known + -k, --known-missing-files a filename which has a list of files known to be missing for this make + -q, --quiet suppress most messages """ def help (text): @@ -64,6 +66,7 @@ include_path = ['.',] master_map_file = '' known_missing_files = [] known_missing_files_file = '' +suppress_output = False initial_map = {} for opt in options_list: o = opt[0] @@ -87,6 +90,8 @@ for opt in options_list: known_missing_files_file = a else: print 'Missing files list file not found: ', a + elif o == '-q' or o == '--quiet': + suppress_output = True else: raise Exception ('unknown option: ' + o) @@ -210,7 +215,8 @@ def process_sections (filename, lang_suffix, page): sections = section_translation_re.findall (page) basename = os.path.splitext (os.path.basename (filename))[0] p = os.path.join (outdir, basename) + lang_suffix + '.xref-map' - print 'writing:', p + if not suppress_output: + print 'writing:', p f = open (p, 'w') this_title = '' @@ -287,6 +293,7 @@ if master_map_file: initial_map[m.group (1)] = (m.group (1), m.group (2), m.group (3)) for filename in files: - print "extract_texi_filenames.py: Processing %s" % filename + if not suppress_output: + print "extract_texi_filenames.py: Processing %s" % filename (lang_suffix, sections) = extract_sections (filename) process_sections (filename, lang_suffix, sections) diff --git a/scripts/build/mass-link.py b/scripts/build/mass-link.py index 17412e5559..00df532f0a 100644 --- a/scripts/build/mass-link.py +++ b/scripts/build/mass-link.py @@ -13,8 +13,6 @@ import os import glob import getopt -print "mass-link.py" - optlist, args = getopt.getopt (sys.argv[1:], '', ['prepend-suffix=']) link_type, source_dir, dest_dir = args[0:3] files = args[3:] -- 2.39.2