Cleanups in gen_licenses.py

Changes include:

- Using asciidoctor's heading style

- (Issue 4424) Add extra \n before closing blockquote so that an
imported LICENSE file without \n at the end won't screw up the rest of
the file

- Change the license anchor to something more distinguishable

- Use '----' instead of '[verse]\n--' for license blockquote, as we have
some hack inside lib/LICENSE-prologcafe using '----' as blockquote.
We could also just change lib/LICENSE-prologcafe file to use '--'
instead, but I feel under asciidoctor's default css, '----' blockquotes
has a slightly grey background, which is easier to read.

Change-Id: I8260c47ffa66cd303b97f78c590cdfd97a8626d4
This commit is contained in:
Yuxuan 'fishy' Wang 2016-08-22 15:46:24 -07:00 committed by David Pursehouse
parent 4feb667bf7
commit 13737a286a
1 changed files with 10 additions and 13 deletions

View File

@ -95,16 +95,14 @@ used = sorted(licenses.keys())
if args.asciidoc:
print("""\
Gerrit Code Review - Licenses
=============================
= Gerrit Code Review - Licenses
Gerrit open source software is licensed under the <<Apache2_0,Apache
License 2.0>>. Executable distributions also include other software
components that are provided under additional licenses.
[[cryptography]]
Cryptography Notice
-------------------
== Cryptography Notice
This distribution includes cryptographic software. The country
in which you currently reside may have restrictions on the import,
@ -139,8 +137,7 @@ and/or the
link:http://www.bouncycastle.org/java.html[Bouncy Castle Crypto API]
to be installed by the end-user.
Licenses
--------
== Licenses
""")
for n in used:
@ -149,13 +146,13 @@ for n in used:
if args.asciidoc:
print()
print('[[%s]]' % name.replace('.', '_'))
print(name)
print('~' * len(name))
print("=== " + name)
print()
else:
print()
print(name)
print('--')
print()
print('----')
for d in libs:
if d.startswith('//lib:') or d.startswith('//lib/'):
p = d[len('//lib:'):]
@ -166,12 +163,12 @@ for n in used:
print('* ' + p)
if args.asciidoc:
print()
print('[[license]]')
print('[verse]')
print('--')
print('[[%s_license]]' % name.replace('.', '_'))
print('----')
with open(n[2:].replace(':', '/')) as fd:
copyfileobj(fd, stdout)
print('--')
print()
print('----')
if args.asciidoc:
print("""