From 93330b4d33120b9330b311b7187551479e2341bd Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 31 May 2006 23:38:23 +0000 Subject: [PATCH] * stepmake/aclocal.m4: revert version detection. * buildscripts/output-distance.py (ComparisonData.create_html_result_page): copy only if file exists, fixup src paths. * stepmake/bin/add-html-footer.py (built): junk gulp_file() --- ChangeLog | 10 ++++++++++ GNUmakefile.in | 4 ++-- buildscripts/output-distance.py | 25 ++++++++++++++++--------- stepmake/aclocal.m4 | 8 ++++++-- stepmake/bin/add-html-footer.py | 23 +++++------------------ 5 files changed, 39 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index b105c3313b..41cd8012c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-06-01 Han-Wen Nienhuys + + * stepmake/aclocal.m4: revert version detection. + + * buildscripts/output-distance.py + (ComparisonData.create_html_result_page): copy only if file + exists, fixup src paths. + + * stepmake/bin/add-html-footer.py (built): junk gulp_file() + 2006-06-01 Jan Nieuwenhuizen * stepmake/aclocal.m4: Robustification for (gcc) version detection. diff --git a/GNUmakefile.in b/GNUmakefile.in index 417b8f10f4..bc9ae17ab0 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -72,13 +72,13 @@ local-WWW-post: echo 'Redirecting to the documentation index...' >> $(outdir)/index.html cd $(top-build-dir) && $(FIND) . -name '*.html' -print | $(footifymail) xargs $(footify) - cd $(top-build-dir) && find . -name \*.html~ -print | xargs rm -f ## rewrite file names so we lose out-www -mv $(outdir)/web-root/ $(outdir)/old-web-root for d in out-www `cd $(top-build-dir) && find Documentation input -name 'out-www' `; do \ + echo $$d ; \ (mkdir -p $(outdir)/web-root/$$d/ || true) ; \ - rsync -a --include source --include music-glossary \ + rsync -Wa --include source --include music-glossary \ --include lilypond-internals \ --include lilypond \ $(foreach pat,$(web-ext), --include '*'.$(pat)) $(top-build-dir)/$$d/ $(outdir)/web-root/$$d/../ ; \ diff --git a/buildscripts/output-distance.py b/buildscripts/output-distance.py index e5f581c0b2..1e25c1813a 100644 --- a/buildscripts/output-distance.py +++ b/buildscripts/output-distance.py @@ -244,7 +244,7 @@ class ComparisonData: f1 = dir1 + '/' + p distance = compare_signature_files (f1, f2) self.result_dict[f2] = (distance, f1) - + def create_text_result_page (self, dir1, dir2): self.write_text_result_page (dir2 + '/' + os.path.split (dir1)[1] + '.txt') @@ -282,22 +282,29 @@ class ComparisonData: results.sort () results.reverse () - + html = '' old_prefix = os.path.split (dir1)[1] dest_dir = os.path.join (dir2, old_prefix) shutil.rmtree (dest_dir, ignore_errors=True) os.mkdir (dest_dir) - for (score, oldfile, newfile) in results: - old_base = re.sub ("-[0-9]+.signature", '', os.path.split (oldfile)[1]) + for (score, oldfile, newfile) in results: + + old_base = re.sub ("-[0-9]+.signature", '', oldfile) + old_name = os.path.split (old_base)[1] new_base = re.sub ("-[0-9]+.signature", '', newfile) for ext in 'png', 'ly': - shutil.copy2 (old_base + '.' + ext, dest_dir) + src_file = old_base + '.' + ext + + if os.path.exists (src_file): + shutil.copy2 (src_file, dest_dir) + else: + print "warning: can't find", src_file - img_1 = os.path.join (old_prefix, old_base + '.png') - ly_1 = os.path.join (old_prefix, old_base + '.ly') + img_1 = os.path.join (old_prefix, old_name + '.png') + ly_1 = os.path.join (old_prefix, old_name + '.ly') img_2 = new_base.replace (dir2, '') + '.png' img_2 = re.sub ("^/*", '', img_2) @@ -345,11 +352,11 @@ class ComparisonData: def compare_trees (dir1, dir2): - data = ComparisonData () + data = ComparisonData () data.compare_trees (dir1, dir2) data.print_results () data.create_html_result_page (dir1, dir2) - data.create_text_result_page (dir1, dir2) +# data.create_text_result_page (dir1, dir2) ################################################################ # TESTING diff --git a/stepmake/aclocal.m4 b/stepmake/aclocal.m4 index 19b9200a40..73cb599d53 100644 --- a/stepmake/aclocal.m4 +++ b/stepmake/aclocal.m4 @@ -32,8 +32,12 @@ AC_DEFUN(STEPMAKE_GET_VERSION, [ ## FIXME: what systems still do not have $() in /bin/sh? eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\.[0-9]' \ | head -n 1 \ - | sed -e 's/\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' \ - -e 's/\([^0-9]*\|^\) //' -e 's/[^0-9]*$//'\`\" + | sed -e 's/.*[^-.0-9]\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' \ + -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\" + +## apparently breaks on darwin, +# | sed -e 's/\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' \ +# -e 's/\([^0-9]*\|^\) //' -e 's/[^0-9]*$//'\`\" if test -z "$_ver"; then ## If empty, try date [fontforge] eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\{6,8\}' \ diff --git a/stepmake/bin/add-html-footer.py b/stepmake/bin/add-html-footer.py index 1a5cbccfc0..7f2ef65dcd 100644 --- a/stepmake/bin/add-html-footer.py +++ b/stepmake/bin/add-html-footer.py @@ -47,7 +47,7 @@ default_footer = r"""
Please take me back to the index of @PACKAGE_NAME@ """ -built = r""" +built = r'''
%(wiki_string)s

@@ -58,23 +58,10 @@ This page is for %(package_name)s-%(package_version)s (%(branch_str)s).
Report errors to %(mail_address)s.

-""" +''' + -def gulp_file (f): - try: - i = open(f) - i.seek (0, 2) - n = i.tell () - i.seek (0,0) - except: - sys.stderr.write ("can't open file: %s\n" % f) - return '' - s = i.read (n) - if len (s) <= 0: - sys.stderr.write ("gulped empty file: %s\n" % f) - i.close () - return s def help (): sys.stdout.write (r"""Usage: add-html-footer [OPTIONS]... HTML-FILE @@ -138,7 +125,7 @@ def set_gcos (): def compose (default, file): s = default if file: - s = gulp_file (file) + s = open (file).read () return s set_gcos () @@ -200,7 +187,7 @@ def remove_self_ref (s): return s def do_file (f): - s = gulp_file (f) + s = open (f).read() s = re.sub ('%', '%%', s) -- 2.39.5