diff options
author | Eric Engestrom <eric@engestrom.ch> | 2020-04-29 02:02:28 +0200 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-06-13 10:42:01 +0000 |
commit | 8bc055fc527af0bd632608c1a2b8015e86fa781c (patch) | |
tree | 1494034eeff06b1993ca6d3fe35fecd87dea637a /bin | |
parent | 9d90791c19ab5aba739e244c0887dd3be09be631 (diff) |
gen_release_notes.py: update script to the new rST way of things
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4630>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/gen_release_notes.py | 105 |
1 files changed, 45 insertions, 60 deletions
diff --git a/bin/gen_release_notes.py b/bin/gen_release_notes.py index 48e216f80cf..3a580a406ca 100755 --- a/bin/gen_release_notes.py +++ b/bin/gen_release_notes.py @@ -39,87 +39,63 @@ CURRENT_GL_VERSION = '4.6' CURRENT_VK_VERSION = '1.2' TEMPLATE = Template(textwrap.dedent("""\ - <%! - import html - %> - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> - <html lang="en"> - <head> - <meta http-equiv="content-type" content="text/html; charset=utf-8"> - <title>Mesa Release Notes</title> - <link rel="stylesheet" type="text/css" href="../mesa.css"> - </head> - <body> - - <div class="header"> - <h1>The Mesa 3D Graphics Library</h1> - </div> - - <iframe src="../contents.html"></iframe> - <div class="content"> - - <h1>Mesa ${this_version} Release Notes / ${today}</h1> - - <p> + ${header} + ${header_underline} + %if not bugfix: - Mesa ${this_version} is a new development release. People who are concerned - with stability and reliability should stick with a previous release or - wait for Mesa ${this_version[:-1]}1. + Mesa ${this_version} is a new development release. People who are concerned + with stability and reliability should stick with a previous release or + wait for Mesa ${this_version[:-1]}1. %else: - Mesa ${this_version} is a bug fix release which fixes bugs found since the ${previous_version} release. + Mesa ${this_version} is a bug fix release which fixes bugs found since the ${previous_version} release. %endif - </p> - <p> + Mesa ${this_version} implements the OpenGL ${gl_version} API, but the version reported by glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. Some drivers don't support all the features required in OpenGL ${gl_version}. OpenGL - ${gl_version} is <strong>only</strong> available if requested at context creation. + ${gl_version} is **only** available if requested at context creation. Compatibility contexts may report a lower version depending on each driver. - </p> - <p> + Mesa ${this_version} implements the Vulkan ${vk_version} API, but the version reported by the apiVersion property of the VkPhysicalDeviceProperties struct depends on the particular driver being used. - </p> - <h2>SHA256 checksum</h2> - <pre> - TBD. - </pre> + SHA256 checksum + --------------- + + :: + + TBD. - <h2>New features</h2> + New features + ------------ - <ul> %for f in features: - <li>${html.escape(f)}</li> + - ${f} %endfor - </ul> - <h2>Bug fixes</h2> - <ul> + Bug fixes + --------- + %for b in bugs: - <li>${html.escape(b)}</li> + - ${b} %endfor - </ul> - <h2>Changes</h2> - <ul> - %for c, author in changes: - %if author: - <p>${html.escape(c)}</p> + Changes + ------- + %for c, author_line in changes: + %if author_line: + + ${c} + %else: - <li>${html.escape(c)}</li> + - ${c} %endif %endfor - </ul> - - </div> - </body> - </html> """)) @@ -159,7 +135,10 @@ async def gather_bugs(version: str) -> typing.List[str]: async with aiohttp.ClientSession(loop=loop) as session: results = await asyncio.gather(*[get_bug(session, i) for i in issues]) typing.cast(typing.Tuple[str, ...], results) - return list(results) + bugs = list(results) + if not bugs: + bugs = ['None'] + return bugs async def get_bug(session: aiohttp.ClientSession, bug_id: str) -> str: @@ -185,8 +164,8 @@ async def get_shortlog(version: str) -> str: def walk_shortlog(log: str) -> typing.Generator[typing.Tuple[str, bool], None, None]: for l in log.split('\n'): if l.startswith(' '): # this means we have a patch description - yield l, False - else: + yield l.lstrip(), False + elif l.strip(): yield l, True @@ -230,6 +209,8 @@ def get_features(is_point_release: bool) -> typing.Generator[str, None, None]: with p.open('rt') as f: for line in f: yield line + else: + yield "None" else: yield "None" @@ -243,13 +224,16 @@ async def main() -> None: version = raw_version.split('-')[0] previous_version = calculate_previous_version(version, is_point_release) this_version = calculate_next_version(version, is_point_release) + today = datetime.date.today() + header = f'Mesa {this_version} Release Notes / {today}' + header_underline = '=' * len(header) shortlog, bugs = await asyncio.gather( get_shortlog(previous_version), gather_bugs(previous_version), ) - final = pathlib.Path(__file__).parent.parent / 'docs' / 'relnotes' / f'{this_version}.html' + final = pathlib.Path(__file__).parent.parent / 'docs' / 'relnotes' / f'{this_version}.rst' with final.open('wt') as f: try: f.write(TEMPLATE.render( @@ -259,7 +243,8 @@ async def main() -> None: features=get_features(is_point_release), gl_version=CURRENT_GL_VERSION, this_version=this_version, - today=datetime.date.today(), + header=header, + header_underline=header_underline, previous_version=previous_version, vk_version=CURRENT_VK_VERSION, )) |