]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add a -q quiet flag to 'make website' scripts
authorPhil Holmes <mail@philholmes.net>
Fri, 6 May 2011 14:06:36 +0000 (15:06 +0100)
committerGraham Percival <graham@percival-music.ca>
Wed, 25 May 2011 17:34:45 +0000 (18:34 +0100)
Documentation/lilypond-texi2html.init
make/website.make
scripts/build/bib2texi.py
scripts/build/extract_texi_filenames.py
scripts/build/mass-link.py

index 0b542ed777f5d93abf2edec69f8adf93e7a93386..1e75f54aa762fd41335189c8f993ff349cad335d 100644 (file)
@@ -847,7 +847,7 @@ $Texi2HTML::Config::DOCTYPE = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Tran
     );
 
 sub web_settings() {
-  print STDERR "Initializing settings for web site: [$Texi2HTML::THISDOC{current_lang}]\n";
+  print STDERR "Processing web site: [$Texi2HTML::THISDOC{current_lang}]\n";
   $Texi2HTML::Config::BODYTEXT = "";
   @Texi2HTML::Config::CSS_REFS      = (
       {FILENAME => "lilypond-website.css", TITLE => "Default style"}
index 5c0528aec9b94834a5c4cc14565392af37611ce7..55e2331633765bdbf3b2694eda40b069e7c469c6 100644 (file)
@@ -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
 
 
index dd896fa8b00b096bd3cec9bcd31b135908cfe7e9..ab8a6b902be6752e2a0aedb1298c3baf3428d340 100644 (file)
@@ -6,12 +6,14 @@ import tempfile
 
 # usage:
 def usage ():
-    print 'usage: %s [-s style] [-o <outfile>] BIBFILES...'
+    print 'usage: %s [-s style] [-o <outfile>] [-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:
index fcb464d53d07b4ef7a99cfaccce2a0d1d1ea7cab..33a31b7af5caad05e0836d387e0313fd0d17e99a 100644 (file)
@@ -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)
index 17412e5559f6aa7b34a0a17c5e1561703aaa3bff..00df532f0a06fa7c543b1acbe506d02b5c560a80 100644 (file)
@@ -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:]