]> git.donarmstrong.com Git - lilypond.git/blobdiff - buildscripts/bib2html.py
Merge branch 'master' of git+ssh://git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / buildscripts / bib2html.py
index 01b893b9b7b82427398c2eae1afedf597038ec5f..f01e9d0051fa17c62822163626937a18f371fd55 100644 (file)
@@ -7,7 +7,7 @@ import string
 
 # usage:
 def usage ():
-    print 'usage: %s [-s style] [-o <outfile>] BIBFILES...';
+  print 'usage: %s [-s style] [-o <outfile>] BIBFILES...';
 
 #print os.environ['BSTINPUTS']
 
@@ -16,36 +16,36 @@ def usage ():
 output = 'bib.html'
 style = 'long'
 for (o,a) in options:
-       if o == '-h' or o == '--help':
-               usage ()
-               sys.exit (0)
-       elif o == '-s' or o == '--style':
-               style = a
-       elif o == '-o' or o == '--output':
-               output = a
-       else:
-               raise 'unknown opt ', o
+    if o == '-h' or o == '--help':
+        usage ()
+        sys.exit (0)
+    elif o == '-s' or o == '--style':
+        style = a
+    elif o == '-o' or o == '--output':
+        output = a
+    else:
+        raise 'unknown opt ', o
 
 
 if style not in ['alpha','index','long','longp','long-pario','short','short-pario','split']:
-    sys.stderr.write ("Unknown style \`%s'\n" % style)
+  sys.stderr.write ("Unknown style \`%s'\n" % style)
 
 tempfile = tempfile.mktemp ('bib2html')
 
 if not files:
-    usage ()
-    sys.exit (2)
+  usage ()
+  sys.exit (2)
 
 
 def strip_extension (f, ext):
-       (p, e) = os.path.splitext (f)
-       if e == ext:
-               e = ''
-       return p + e
+    (p, e) = os.path.splitext (f)
+    if e == ext:
+        e = ''
+    return p + e
 
 nf = []
 for f in files:
-    nf.append (strip_extension(f, '.bib'))
+  nf.append (strip_extension(f, '.bib'))
 
 files = string.join (nf,',')
 
@@ -60,7 +60,7 @@ cmd = "bibtex %s" % tempfile;
 sys.stdout.write ("Invoking `%s'\n" % cmd)
 stat = os.system (cmd)
 if stat <> 0:
-    sys.exit(1)
+  sys.exit(1)
 
 
 #TODO: do tex -> html on output 
@@ -71,8 +71,8 @@ open (output, 'w').write  (bbl)
 
 
 def cleanup (tempfile):
-    for a in ['aux','bbl', 'blg']:
-       os.unlink (tempfile + '.' + a)
+  for a in ['aux','bbl', 'blg']:
+    os.unlink (tempfile + '.' + a)
 
 cleanup(tempfile)