X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=buildscripts%2Fbib2html.py;h=f01e9d0051fa17c62822163626937a18f371fd55;hb=aba6c8799c831db5928209f9842efe721b6708ab;hp=37bc4694fd35455014b39cfdbe9f17db8bc19241;hpb=c3f1e9e806a3d386f82439130f9593c3537ed08c;p=lilypond.git diff --git a/buildscripts/bib2html.py b/buildscripts/bib2html.py index 37bc4694fd..f01e9d0051 100644 --- a/buildscripts/bib2html.py +++ b/buildscripts/bib2html.py @@ -7,45 +7,45 @@ import string # usage: def usage (): - print 'usage: %s [-s style] [-o ] BIBFILES...'; - + print 'usage: %s [-s style] [-o ] BIBFILES...'; +#print os.environ['BSTINPUTS'] (options, files) = getopt.getopt(sys.argv[1:], 's:o:', []) 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,',') @@ -58,19 +58,21 @@ open(tempfile + '.aux', 'w').write (r''' cmd = "bibtex %s" % tempfile; sys.stdout.write ("Invoking `%s'\n" % cmd) -os.system (cmd) +stat = os.system (cmd) +if stat <> 0: + sys.exit(1) #TODO: do tex -> html on output -bbl =open (tempfile + '.bbl').read () +bbl = open (tempfile + '.bbl').read () 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)