Commit 77721d8b authored by Michele Tartara's avatar Michele Tartara
Browse files

Introduce support for alpha versions

An alpha version can be used to name a release while a previous one is still
being developed.

E.g. 2.9.0~alpha1 can be out while 2.8.0~rc1 is being worked on.

When a version is marked as alpha, it is allowed to have unreleased versions
before it in the NEWS file, in order to simplify merges of the NEWS file itself
between the two development branches.

Partially fixes Issue 448.
Signed-off-by: default avatarMichele Tartara <>
Reviewed-by: default avatarKlaus Aehlig <>
parent dadc7864
...@@ -39,7 +39,7 @@ DASHES_RE = re.compile(r"^\s*-+\s*$") ...@@ -39,7 +39,7 @@ DASHES_RE = re.compile(r"^\s*-+\s*$")
RELEASED_RE = re.compile(r"^\*\(Released (?P<day>[A-Z][a-z]{2})," RELEASED_RE = re.compile(r"^\*\(Released (?P<day>[A-Z][a-z]{2}),"
r" (?P<date>.+)\)\*$") r" (?P<date>.+)\)\*$")
UNRELEASED_RE = re.compile(r"^\*\(unreleased\)\*$") UNRELEASED_RE = re.compile(r"^\*\(unreleased\)\*$")
VERSION_RE = re.compile(r"^Version (\d+(\.\d+)+( (beta|rc)\d+)?)$") VERSION_RE = re.compile(r"^Version (\d+(\.\d+)+( (alpha|beta|rc)\d+)?)$")
#: How many days release timestamps may be in the future #: How many days release timestamps may be in the future
...@@ -68,6 +68,21 @@ def ReqNLines(req, count_empty, lineno, line): ...@@ -68,6 +68,21 @@ def ReqNLines(req, count_empty, lineno, line):
(lineno, line, req, count_empty)) (lineno, line, req, count_empty))
def IsAlphaVersion(version):
return "alpha" in version
def UpdateAllowUnreleased(allow_unreleased, version_match, release):
if not allow_unreleased:
return False
if IsAlphaVersion(release):
return True
version =
if version == release:
return False
return True
def main(): def main():
# Ensure "C" locale is used # Ensure "C" locale is used
curlocale = locale.getlocale() curlocale = locale.getlocale()
...@@ -95,8 +110,8 @@ def main(): ...@@ -95,8 +110,8 @@ def main():
Error("Line %s: Duplicate release %s found" % Error("Line %s: Duplicate release %s found" %
(fileinput.filelineno(), version)) (fileinput.filelineno(), version))
found_versions.add(version) found_versions.add(version)
if version == release: allow_unreleased = UpdateAllowUnreleased(allow_unreleased, version_match,
allow_unreleased = False release)
unreleased_match = UNRELEASED_RE.match(line) unreleased_match = UNRELEASED_RE.match(line)
if unreleased_match and not allow_unreleased: if unreleased_match and not allow_unreleased:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment