diff options
author | lloyd <[email protected]> | 2014-12-06 12:59:45 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-12-06 12:59:45 +0000 |
commit | f2db2cd88fd868d282d2782de2499eb7ee0d29bc (patch) | |
tree | b95fb79b3d92b582ae4b04a66194453f4a58f9b4 /src/scripts | |
parent | 2f884827b2aa1b070795230ebe012f1708ded73a (diff) |
Combine release notes into single text file on install
Diffstat (limited to 'src/scripts')
-rwxr-xr-x | src/scripts/combine_relnotes.py | 45 | ||||
-rwxr-xr-x | src/scripts/install.py | 5 |
2 files changed, 38 insertions, 12 deletions
diff --git a/src/scripts/combine_relnotes.py b/src/scripts/combine_relnotes.py index df6bd5168..1503a0676 100755 --- a/src/scripts/combine_relnotes.py +++ b/src/scripts/combine_relnotes.py @@ -1,11 +1,20 @@ #!/usr/bin/python +""" +(C) 2014 Jack Lloyd + +Distributed under the terms of the Botan license +""" + import re import sys +import os -def main(args = None): - if args is None: - args = sys.argv +def combine_relnotes(relnote_dir): + + relnotes = [p for p in os.listdir(relnote_dir) if p.startswith(('0', '1', '2'))] + + print relnotes re_version = re.compile('Version (\d+\.\d+\.\d+), ([0-9]{4}-[0-9]{2}-[0-9]{2})$') re_nyr = re.compile('Version (\d+\.\d+\.\d+), Not Yet Released$') @@ -15,8 +24,8 @@ def main(args = None): versions = [] versions_nyr = [] - for f in args[1:]: - contents = open(f).readlines() + for f in relnotes: + contents = open(os.path.join(relnote_dir, f)).readlines() match = re_version.match(contents[0]) @@ -38,9 +47,11 @@ def main(args = None): def make_label(v): return ".. _v%s:\n" % (v.replace('.', '_')) - print "Release Notes" - print "========================================" - print + s = '' + + s += "Release Notes\n" + s += "========================================\n" + s += "\n" date_to_version = {} for (v,d) in version_date.items(): @@ -48,13 +59,23 @@ def main(args = None): if len(versions_nyr) > 0: for v in versions_nyr: - print make_label(v) - print version_contents[v], "\n" + s += make_label(v) + "\n" + s += version_contents[v] + s += "\n\n" for d in sorted(date_to_version.keys(), reverse=True): for v in sorted(date_to_version[d]): - print make_label(v) - print version_contents[v], "\n" + s += make_label(v) + "\n" + s += version_contents[v] + s += "\n\n" + + return s + +def main(args = None): + if args is None: + args = sys.argv + + print combine_relnotes(args[1]) if __name__ == '__main__': sys.exit(main()) diff --git a/src/scripts/install.py b/src/scripts/install.py index 52b197619..a6f25e955 100755 --- a/src/scripts/install.py +++ b/src/scripts/install.py @@ -8,6 +8,8 @@ import shutil import string import sys +import combine_relnotes + def parse_command_line(args): parser = optparse.OptionParser() @@ -191,6 +193,9 @@ def main(args = None): with open(os.path.join(botan_doc_dir, 'license.txt'), 'w+') as lic: lic.write(license_text('doc/license.rst')) + with open(os.path.join(botan_doc_dir, 'news.txt'), 'w+') as news: + news.write(combine_relnotes.combine_relnotes('doc/relnotes')) + logging.info('Botan %s installation complete', build_vars['version']) if __name__ == '__main__': |