X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=stepmake%2Fbin%2Fadd-html-footer.py;h=1a5cbccfc013da265ef2edb6ebc60d5a4acd354b;hb=9f3572d98bb948c9689cd1f75401a029451fa001;hp=7f2ef65dcd89e80edeb9a57bda163098e3baec3a;hpb=04265f11d1f21416ccebd2dcaa1d903dc781b36e;p=lilypond.git
diff --git a/stepmake/bin/add-html-footer.py b/stepmake/bin/add-html-footer.py
index 7f2ef65dcd..1a5cbccfc0 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,10 +58,23 @@ 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
@@ -125,7 +138,7 @@ def set_gcos ():
def compose (default, file):
s = default
if file:
- s = open (file).read ()
+ s = gulp_file (file)
return s
set_gcos ()
@@ -187,7 +200,7 @@ def remove_self_ref (s):
return s
def do_file (f):
- s = open (f).read()
+ s = gulp_file (f)
s = re.sub ('%', '%%', s)