From 9f20af81df965b1f0c3e2c11614ea4e44dc4268f Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 27 May 2019 09:32:53 -0400 Subject: More flexible version number finding --- ci/upload_relnotes.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'ci') diff --git a/ci/upload_relnotes.py b/ci/upload_relnotes.py index 1cc89013..a5dd7fe5 100644 --- a/ci/upload_relnotes.py +++ b/ci/upload_relnotes.py @@ -13,6 +13,9 @@ Run with two arguments: the .rst file to parse, and the Tidelift package name: python upload_relnotes.py CHANGES.rst pypi/coverage +Every section that has something that looks like a version number in it will +be uploaded as the release notes for that version. + """ import os.path @@ -85,12 +88,13 @@ def relnotes(mdlines): Each tuple is a separate version mentioned in the release notes. - A version is an h2 that starts with "Version ". + A version is any section with \d\.\d in the header text. """ - for hlevel, htext, text in sections(parse_md(mdlines)): - if hlevel == 'h2' and htext.startswith('Version '): - version = htext.split()[1] + for _, htext, text in sections(parse_md(mdlines)): + m_version = re.search(r"\d+\.\d[^ ]*", htext) + if m_version: + version = m_version.group() yield version, text def convert_rst_file_to_markdown(rst_filename): -- cgit v1.2.1