From: Jan Nieuwenhuizen Date: Thu, 22 Mar 2001 22:32:47 +0000 (+0100) Subject: patch::: 1.3.141.jcn1 X-Git-Tag: release/1.3.142~5 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=76c78be46431a98a1417580d9d67bf67e4ba06ee;p=lilypond.git patch::: 1.3.141.jcn1 1.3.141.jcn1 ============ * scripts/update-lily.py: fancy source rebuild update tool that we're probably not going to use on www.lilypond.org. Check it out! * Bugfix: building of topdocs. --- diff --git a/CHANGES b/CHANGES index 9d254b09da..05c14850a9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,11 @@ +1.3.141.jcn1 +============ + +* scripts/update-lily.py: fancy source rebuild update tool that we're +probably not going to use on www.lilypond.org. Check it out! + +* Bugfix: building of topdocs. + 1.3.140.jcn6 ============ diff --git a/Documentation/topdocs/GNUmakefile b/Documentation/topdocs/GNUmakefile index 80ab9a654a..10f82f091d 100644 --- a/Documentation/topdocs/GNUmakefile +++ b/Documentation/topdocs/GNUmakefile @@ -1,22 +1,8 @@ depth = ../.. -STEPMAKE_TEMPLATES=documentation tex texinfo +STEPMAKE_TEMPLATES=documentation tex texinfo topdocs LOCALSTEPMAKE_TEMPLATES=lilypond ly HTML_FILES=$(addprefix $(outdir)/, $(TEXI_FILES:.texi=.html) $(TELY_FILES:.tely=.html)) -#default: local-doc - include $(depth)/make/stepmake.make - -copy-to-top: $(TO_TOP_FILES) - $(foreach i, $(TO_TOP_FILES), \ - cp $(i) $(depth)/ && ) true - -cp $(outdir)/*png $(outdir)/index.html $(depth) # don't fail if not making website - -###local-WWW: copy-to-top - -local-WWW: $(HTML_FILES) copy-to-top -# we want footers even if website builds (or is built) partly - $(MAKE) footify - diff --git a/GNUmakefile.in b/GNUmakefile.in index 646742c443..ec01807e4b 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -72,7 +72,7 @@ lily: lily/$(outdir)/lilypond lily/$(outdir)/lilypond: $(MAKE) -C lily -local-web: fonts lily $(TOP_HTMLS:%.html=%) footify top-web +local-web: fonts lily $(TOP_HTMLS:%.html=%) footify do-top-doc top-web top-web: rm -f `find . -name \*.html~ -print` diff --git a/VERSION b/VERSION index e2374e6412..32adce85b8 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=141 -MY_PATCH_LEVEL= +MY_PATCH_LEVEL=jcn1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/buildscripts/GNUmakefile b/buildscripts/GNUmakefile index 875833e447..a1d371d022 100755 --- a/buildscripts/GNUmakefile +++ b/buildscripts/GNUmakefile @@ -1,7 +1,7 @@ # bin/Makefile depth = .. -STEPMAKE_TEMPLATES=script install +STEPMAKE_TEMPLATES=script install po include $(depth)/make/stepmake.make @@ -14,3 +14,4 @@ all: $(outdir)/gettext.py + diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 0ce1bbc946..c27f2f19d3 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -1,10 +1,10 @@ #!@PYTHON@ - -# convert-lilypond.py -- convertor for lilypond versions +# +# convert-ly.py -- convertor for lilypond versions # # source file of the GNU LilyPond music typesetter # -# (c) 1998 +# (c) 1998--2001 # TODO # use -f and -t for -s output diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index 9a4d5a05c0..a29429947b 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -61,61 +61,55 @@ extra_init = { extra_fields = extra_init.keys () fields = layout_fields + extra_fields -original_dir = os.getcwd () +program_name = 'ly2dvi' +help_summary = _("Generate .dvi with LaTeX for LilyPond") + include_path = ['.'] -temp_dir = '' -keep_temp_dir = 0 no_lily = 0 outdir = '.' track_dependencies_p = 0 - dependency_files = [] - -program_version = '@TOPLEVEL_VERSION@' -if program_version == '@' + 'TOPLEVEL_VERSION' + '@': - program_version = '1.3.134' - # generate ps ? postscript_p = 0 # be verbose? verbose_p = 0 -option_definitions = [ - ('', 'h', 'help', _ ("this help")), - ('KEY=VAL', 's', 'set', _ ("change global setting KEY to VAL")), - ('', 'P', 'postscript', _ ("generate PostScript output")), - ('', 'k', 'keep', _ ("keep all output, and name the directory ly2dvi.dir")), - ('', '', 'no-lily', _ ("don't run LilyPond")), - ('', 'V', 'verbose', _ ("verbose")), - ('', 'v', 'version', _ ("print version number")), - ('', 'w', 'warranty', _ ("show warranty and copyright")), - ('DIR', '', 'outdir', _ ("dump all final output into DIR")), - ('', 'd', 'dependencies', _ ("write Makefile dependencies for every input file")), - ] + +# lily_py.py -- options and stuff +# +# source file of the GNU LilyPond music typesetter + +# BEGIN Library for these? +# cut-n-paste from ly2dvi + +program_version = '@TOPLEVEL_VERSION@' +if program_version == '@' + 'TOPLEVEL_VERSION' + '@': + program_version = '1.3.142' + + +original_dir = os.getcwd () +temp_dir = '%s.dir' % program_name +keep_temp_dir_p = 0 +verbose_p = 0 def identify (): - sys.stdout.write ('ly2dvi (GNU LilyPond) %s\n' % program_version) + sys.stdout.write ('%s (GNU LilyPond) %s\n' % (program_name, program_version)) def warranty (): identify () sys.stdout.write ('\n') - sys.stdout.write (_ ('Copyright (c) %s by' % ' 1998-2001')) + sys.stdout.write (_ ('Copyright (c) %s by' % ' 2001')) sys.stdout.write ('\n') sys.stdout.write (' Han-Wen Nienhuys') + sys.stdout.write (' Jan Nieuwenhuizen') sys.stdout.write ('\n') sys.stdout.write (_ (r''' Distributed under terms of the GNU General Public License. It comes with NO WARRANTY.''')) sys.stdout.write ('\n') - - -def star_progress (s): - '''Progress messages that stand out between lilypond stuff''' - progress ('*** ' + s) - def progress (s): sys.stderr.write (s + '\n') @@ -129,34 +123,6 @@ def error (s): sys.stderr.write ('\n') raise _ ("Exiting ... ") - -def find_file (name): - ''' - Search the include path for NAME. If found, return the (CONTENTS, PATH) of the file. - ''' - - f = None - nm = '' - for a in include_path: - try: - nm = os.path.join (a, name) - f = open (nm) - __main__.read_files.append (nm) - break - except IOError: - pass - if f: - sys.stderr.write (_ ("Reading %s...") % nm) - sys.stderr.write ('\n'); - return (f.read (), nm) - else: - error (_ ("can't open file: `%s'" % name)) - sys.stderr.write ('\n'); - return ('', '') - - - - def getopt_args (opts): '''Construct arguments (LONG, SHORT) for getopt from list of options.''' short = '' @@ -213,16 +179,14 @@ def options_help_str (opts): return str def help (): - sys.stdout.write (_ ("Usage: %s [OPTION]... FILE") % 'ly2dvi') + sys.stdout.write (_ ("Usage: %s [OPTION]... FILE") % program_name) sys.stdout.write ('\n\n') - sys.stdout.write (_ ("Generate .dvi with LaTeX for LilyPond")) + sys.stdout.write (help_summary) sys.stdout.write ('\n\n') sys.stdout.write (_ ("Options:")) sys.stdout.write ('\n') sys.stdout.write (options_help_str (option_definitions)) sys.stdout.write ('\n\n') - warning (_ ("all output is written in the CURRENT directory")) - sys.stdout.write ('\n') sys.stdout.write (_ ("Report bugs to %s") % 'bug-gnu-music@gnu.org') sys.stdout.write ('\n') sys.exit (0) @@ -230,30 +194,13 @@ def help (): def setup_temp (): global temp_dir - temp_dir = 'ly2dvi.dir' - if not keep_temp_dir: - temp_dir = tempfile.mktemp ('ly2dvi') - + if not keep_temp_dir_p: + temp_dir = tempfile.mktemp (program_name) try: os.mkdir (temp_dir, 0777) except OSError: pass - - # try not to gen/search MF stuff in temp dir - fp = '' - try: - fp = ':' + os.environ['TFMFONTS'] - except KeyError: - fp = '://:' - - - os.environ['TFMFONTS'] = original_dir + fp - - os.chdir (temp_dir) - if verbose_p: - progress (_ ('Temp directory is `%s\'\n') % temp_dir) - def system (cmd, ignore_error = 0): if verbose_p: @@ -268,24 +215,12 @@ def system (cmd, ignore_error = 0): return st + def cleanup_temp (): - if not keep_temp_dir: + if not keep_temp_dir_p: if verbose_p: progress (_ ('Cleaning up `%s\'') % temp_dir) system ('rm -rf %s' % temp_dir) - - -def run_lilypond (files): - opts = '' - opts = opts + ' ' + string.join (map (lambda x : '-I ' + x, include_path)) - opts = opts + ' ' + string.join (map (lambda x : '-H ' + x, fields)) - - if track_dependencies_p: - opts = opts + " --dependencies " - - fs = string.join (files) - - system ('lilypond %s %s ' % (opts, fs)) def set_setting (dict, key, val): @@ -300,7 +235,33 @@ def set_setting (dict, key, val): except KeyError: warning (_ ("no such setting: %s") % `key`) dict[key] = [val] + +# END Library + +option_definitions = [ + ('', 'h', 'help', _ ("this help")), + ('KEY=VAL', 's', 'set', _ ("change global setting KEY to VAL")), + ('', 'P', 'postscript', _ ("generate PostScript output")), + ('', 'k', 'keep', _ ("keep all output, and name the directory ly2dvi.dir")), + ('', '', 'no-lily', _ ("don't run LilyPond")), + ('', 'V', 'verbose', _ ("verbose")), + ('', 'v', 'version', _ ("print version number")), + ('', 'w', 'warranty', _ ("show warranty and copyright")), + ('DIR', '', 'outdir', _ ("dump all final output into DIR")), + ('', 'd', 'dependencies', _ ("write Makefile dependencies for every input file")), + ] + +def run_lilypond (files): + opts = '' + opts = opts + ' ' + string.join (map (lambda x : '-I ' + x, include_path)) + opts = opts + ' ' + string.join (map (lambda x : '-H ' + x, fields)) + + if track_dependencies_p: + opts = opts + " --dependencies " + + fs = string.join (files) + system ('lilypond %s %s ' % (opts, fs)) def analyse_lilypond_output (filename, extra): '''Grep FILENAME for interesting stuff, and @@ -526,7 +487,7 @@ for opt in options: elif o == '--postscript' or o == '-P': postscript_p = 1 elif o == '--keep' or o == '-k': - keep_temp_dir = 1 + keep_temp_dir_p = 1 elif o == '--no-lily': no_lily = 1 elif o == '--outdir': diff --git a/scripts/update-lily.py b/scripts/update-lily.py new file mode 100644 index 0000000000..7214a5cda0 --- /dev/null +++ b/scripts/update-lily.py @@ -0,0 +1,394 @@ +#!@PYTHON@ +# +# update-lily.py -- lilypond autobuilder +# +# source file of the GNU LilyPond music typesetter +# +# download and rebuild latest lilypond or from specified url +# + +''' +TODO: + * more flexible build paths + * cleanup previous tree + * flexible build command + * show only? +''' + +import os +import fnmatch +import stat +import string +import re +import getopt +import sys +import __main__ +import operator +import tempfile + + +sys.path.append ('@datadir@/python') +import gettext +gettext.bindtextdomain ('lilypond', '@localedir@') +gettext.textdomain('lilypond') +_ = gettext.gettext + + +program_name = 'build-lily' +package_name = 'lilypond' +help_summary = _("Fetch and rebuild from latest source package") +build_root = os.environ ['HOME'] + '/usr/src' +release_dir = build_root + '/releases' +patch_dir = build_root + '/patches' + +url = 'file:/home/ftp/pub/gnu/LilyPond/development/lilypond-*.tar.gz' +url = 'ftp://appel.lilypond.org/pub/gnu/LilyPond/development/lilypond-*.tar.gz' +url = 'ftp://ftp.cs.uu.nl/pub/GNU/LilyPond/development/lilypond-*.tar.gz' + + +# lily_py.py -- options and stuff +# +# source file of the GNU LilyPond music typesetter + +# BEGIN Library for these? +# cut-n-paste from ly2dvi + +program_version = '@TOPLEVEL_VERSION@' +if program_version == '@' + 'TOPLEVEL_VERSION' + '@': + program_version = '1.3.142' + + +original_dir = os.getcwd () +temp_dir = '%s.dir' % program_name +keep_temp_dir_p = 0 +verbose_p = 0 + +def identify (): + sys.stdout.write ('%s (GNU LilyPond) %s\n' % (program_name, program_version)) + +def warranty (): + identify () + sys.stdout.write ('\n') + sys.stdout.write (_ ('Copyright (c) %s by' % ' 2001')) + sys.stdout.write ('\n') + sys.stdout.write (' Han-Wen Nienhuys') + sys.stdout.write (' Jan Nieuwenhuizen') + sys.stdout.write ('\n') + sys.stdout.write (_ (r''' +Distributed under terms of the GNU General Public License. It comes with +NO WARRANTY.''')) + sys.stdout.write ('\n') + +def progress (s): + sys.stderr.write (s + '\n') + +def warning (s): + sys.stderr.write (_ ("warning: ") + s) + sys.stderr.write ('\n') + + +def error (s): + sys.stderr.write (_ ("error: ") + s) + sys.stderr.write ('\n') + raise _ ("Exiting ... ") + +def getopt_args (opts): + '''Construct arguments (LONG, SHORT) for getopt from list of options.''' + short = '' + long = [] + for o in opts: + if o[1]: + short = short + o[1] + if o[0]: + short = short + ':' + if o[2]: + l = o[2] + if o[0]: + l = l + '=' + long.append (l) + return (short, long) + +def option_help_str (o): + '''Transform one option description (4-tuple ) into neatly formatted string''' + sh = ' ' + if o[1]: + sh = '-%s' % o[1] + + sep = ' ' + if o[1] and o[2]: + sep = ',' + + long = '' + if o[2]: + long= '--%s' % o[2] + + arg = '' + if o[0]: + if o[2]: + arg = '=' + arg = arg + o[0] + return ' ' + sh + sep + long + arg + + +def options_help_str (opts): + '''Convert a list of options into a neatly formatted string''' + w = 0 + strs =[] + helps = [] + + for o in opts: + s = option_help_str (o) + strs.append ((s, o[3])) + if len (s) > w: + w = len (s) + + str = '' + for s in strs: + str = str + '%s%s%s\n' % (s[0], ' ' * (w - len(s[0]) + 3), s[1]) + return str + +def help (): + sys.stdout.write (_ ("Usage: %s [OPTION]... FILE") % program_name) + sys.stdout.write ('\n\n') + sys.stdout.write (help_summary) + sys.stdout.write ('\n\n') + sys.stdout.write (_ ("Options:")) + sys.stdout.write ('\n') + sys.stdout.write (options_help_str (option_definitions)) + sys.stdout.write ('\n\n') + sys.stdout.write (_ ("Report bugs to %s") % 'bug-gnu-music@gnu.org') + sys.stdout.write ('\n') + sys.exit (0) + + +def setup_temp (): + global temp_dir + if not keep_temp_dir_p: + temp_dir = tempfile.mktemp (program_name) + try: + os.mkdir (temp_dir, 0777) + except OSError: + pass + + +def system (cmd, ignore_error = 0): + if verbose_p: + progress (_ ("Invoking `%s\'") % cmd) + st = os.system (cmd) + if st: + msg = ( _ ("error: ") + _ ("command exited with value %d") % st) + if ignore_error: + sys.stderr.write (msg + ' ' + _ ("(ignored)") + ' ') + else: + error (msg) + + return st + + +def cleanup_temp (): + if not keep_temp_dir_p: + if verbose_p: + progress (_ ('Cleaning up `%s\'') % temp_dir) + system ('rm -rf %s' % temp_dir) + + +def set_setting (dict, key, val): + try: + val = string.atof (val) + except ValueError: + #warning (_ ("invalid value: %s") % `val`) + pass + + try: + dict[key].append (val) + except KeyError: + warning (_ ("no such setting: %s") % `key`) + dict[key] = [val] + +# END Library + +option_definitions = [ + ('DIR', 'b', 'build-root', _ ("unpack and build in DIR [%s]") % build_root), + ('', 'h', 'help', _ ("this help")), + ('', 'k', 'keep', _ ("keep all output, and name the directory %s") % temp_dir), + ('', 'V', 'verbose', _ ("verbose")), + ('', 'v', 'version', _ ("print version number")), + ('URL', 'u', 'url', _ ("fetch and build URL [%s]") % url), + ('', 'w', 'warranty', _ ("show warranty and copyright")), + ] + +def list_file (user, passwd, host, dir, file): + match = [] + for i in os.listdir (dir): + if fnmatch.fnmatch (i, file): + match.append (i) + return match + +list_ = list_file + +def list_ftp (user, passwd, host, dir, file): + if user == 'None': + user = 'anonymous' + if passwd == 'None': + passwd = program_name + + command = ''' +open -u%s,%s -p21 %s +set passive-mode off +cd "%s" +ls -1 "%s" +''' % (user, passwd, host, dir, file) + temp = tempfile.mktemp (program_name) + f = open (temp, 'w') + f.write (command) + f.close () + p = os.popen ('lftp -f %s' % temp, 'r') + s = p.read () + status = p.close () + return string.split (s[:-1], '\n') + +def split_url (url): + m = re.match ('([^:/]*)(:)?(/*([^:]*):)?(/*([^@]*)@)?(//([^/]*))?(.*)/(.*)', + url) + if not m: + error ("can't parse url: %s " % url) + return (m.group (1), m.group (4), m.group (6), m.group (8), + m.group (9), m.group (10)) + +def list_url (url): + s = "list_%s ('%s', '%s', '%s', '%s', '%s')" % split_url (url) + return eval (s) + +def version_tuple_to_str (t): + if t[3]: + my = '.%s%d' % (t[3], t[4]) + else: + my = '' + return ('%d.%d.%d' % t[0:3]) + my + +def version_str_to_tuple (s): + t = string.split (s, '.') + if len (t) >= 4: + my_name = t[3][:-1] + my_number = string.atoi (t[3][-1]) + else: + my_name = None + my_number = None + return (string.atoi (t[0]), string.atoi (t[1]), string.atoi (t[2]), + my_name, my_number) + +def split_package (p): + m = re.match ('(.*)-([0-9]*.*).tar.gz', p) + return (m.group (1), version_str_to_tuple (m.group (2))) + +def join_package (t): + return t[0] + '-' + version_tuple_to_str (t[1]) + +def copy_file (user, passwd, host, dir, file): + os.system ('cp %s/%s .' % (dir, file)) + +copy_ = copy_file + +def copy_ftp (user, passwd, host, dir, file): + if user == 'None': + user = 'anonymous' + if passwd == 'None': + passwd = program_name + + command = ''' +open -u%s,%s -p21 %s +set passive-mode off +cd "%s" +get "%s" +''' % (user, passwd, host, dir, file) + temp = tempfile.mktemp (program_name) + f = open (temp, 'w') + f.write (command) + f.close () + p = os.popen ('lftp -f %s' % temp, 'r') + s = p.read () + status = p.close () + +def copy_url (url, dir): + os.chdir (dir) + s = "copy_%s ('%s', '%s', '%s', '%s', '%s')" % split_url (url) + eval (s) + + +def find_latest (url): + progress (_ ("listing %s...") % url) + list = map (split_package, list_url (url)) + list.sort () + return join_package (list[-1]) + +def build (p): + os.chdir (build_root) + system ('tar xzf %s/%s.tar.gz' % (release_dir, p)) + os.chdir (p) + return system ('./configure; make web') + +(sh, long) = getopt_args (__main__.option_definitions) +try: + (options, files) = getopt.getopt(sys.argv[1:], sh, long) +except: + help () + sys.exit (2) + +for opt in options: + o = opt[0] + a = opt[1] + + if 0: + pass + elif o == '--help' or o == '-h': + help () + elif o == '--buid-root' or o == '-b': + build_root = a + elif o == '--url' or o == '-u': + url = a + elif o == '--verbose' or o == '-V': + verbose_p = 1 + elif o == '--version' or o == '-v': + identify () + sys.exit (0) + elif o == '--warranty' or o == '-w': + warranty () + sys.exit (0) + +if 1: + latest = find_latest (url) + + if os.path.isdir ('%s/%s' % (build_root, latest)): + progress (_ ("latest is %s") % latest) + progress (_ ("relax, %s is up to date" % package_name)) + sys.exit (0) + + get_base = url[:string.rindex (url, '/')] + '/' + latest + if os.path.isdir (patch_dir): + os.chdir (patch_dir) + get = get_base + '.diff.tar.gz' + progress (_ ("fetching %s...") % get) + copy_url (get, '.') + + if not os.path.isdir (build_dir): + build_dir = temp_dir + if not os.path.isdir (release_dir): + release_dir = temp_dir + setup_temp () + + os.chdir (temp_dir) + get = get_base + '.tar.gz' + progress (_ ("fetching %s...") % get) + copy_url (get, '.') + + if not build (latest): + os.link ('%s/%s package_name' % (package_name, build_root, latest)) + previous = 'hairy' + if os.path.isdir ('%s/%s' % (build_root, previous)): + system ('rm -rf %s/%s' % (build_root, previous)) + + os.chdir (original_dir) + if release_dir != temp_dir: + cleanup_temp () + sys.exit (0) + diff --git a/stepmake/stepmake/topdocs-rules.make b/stepmake/stepmake/topdocs-rules.make new file mode 100644 index 0000000000..7a548bc2cf --- /dev/null +++ b/stepmake/stepmake/topdocs-rules.make @@ -0,0 +1 @@ +#epmty \ No newline at end of file diff --git a/stepmake/stepmake/topdocs-targets.make b/stepmake/stepmake/topdocs-targets.make new file mode 100644 index 0000000000..f820c182a4 --- /dev/null +++ b/stepmake/stepmake/topdocs-targets.make @@ -0,0 +1,14 @@ + +default: local-doc + +copy-to-top: $(TO_TOP_FILES) + $(foreach i, $(TO_TOP_FILES), \ + cp $(i) $(depth)/ && ) true + -cp $(outdir)/*png $(outdir)/index.html $(depth) # don't fail if not making website + +###local-WWW: copy-to-top + +local-WWW: $(HTML_FILES) copy-to-top +# we want footers even if website builds (or is built) partly + $(MAKE) footify + diff --git a/stepmake/stepmake/topdocs-vars.make b/stepmake/stepmake/topdocs-vars.make new file mode 100644 index 0000000000..336c26b984 --- /dev/null +++ b/stepmake/stepmake/topdocs-vars.make @@ -0,0 +1,2 @@ +TO_TOP_FILES=$(addprefix $(outdir)/, $(README_TOP_FILES)) + diff --git a/stepmake/stepmake/toplevel-vars.make b/stepmake/stepmake/toplevel-vars.make index 6486853b6c..6ab5a4ed16 100644 --- a/stepmake/stepmake/toplevel-vars.make +++ b/stepmake/stepmake/toplevel-vars.make @@ -2,8 +2,6 @@ # override Generic_vars.make: DIST_FILES := $(EXTRA_DIST_FILES) -TO_TOP_FILES=$(addprefix $(outdir)/, $(README_TOP_FILES)) - # urg? include $(stepdir)/documentation-vars.make