diff --git a/docs/changelog.rst b/docs/changelog.rst index 01a5318d..bae89718 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -21,6 +21,11 @@ To avail of fixes in an unreleased version, please download a ZIP file In progress (unreleased) ------------------------ + + +v0.3.25a1 (2025-06-05) +---------------------- + * :gh:issue:`1258` Initial Ansible 12 (ansible-core 2.19) support * :gh:issue:`1258` :mod:`ansible_mitogen`: Initial Ansible datatag support (:gh:anspull:`84621`) diff --git a/docs/conf.py b/docs/conf.py index 4fb2b300..4bffabd8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -5,6 +5,8 @@ sys.path.append('.') def changelog_version(path, encoding='utf-8'): + "Return the 1st *stable* (not pre, dev) version in the changelog" + # See also grep_version() in setup.py version_pattern = re.compile( r'^v(?P[0-9]+\.[0-9]+\.[0-9]+)', re.MULTILINE, diff --git a/setup.py b/setup.py index 1639d383..f8aeffea 100644 --- a/setup.py +++ b/setup.py @@ -33,15 +33,34 @@ from setuptools import find_packages, setup def grep_version(): + # See also changlelog_version() in docs.conf.py path = os.path.join(os.path.dirname(__file__), 'mitogen/__init__.py') + + # Based on https://packaging.python.org/en/latest/specifications/version-specifiers/#appendix-parsing-version-strings-with-regular-expressions + # e.g. "__version__ = (0, 1, 2)", "__version__ = (0, 1, 3, 'dev')", + # "__version__ = (0, 1, 4, 'a', 1)" version_pattern = re.compile( - r"__version__ = \((\d+), (\d+), (\d+)(?:, '(dev)')?\)", + r''' + ^__version__\s=\s\( + (?P\d+) + ,\s + (?P\d+) + ,\s + (?P\d+) + (?: + (?:,\s '(?Pdev)') + | (?:,\s '(?Pa|b)' ,\s (?P\d+)) + )? + \) + $ + ''', + re.MULTILINE | re.VERBOSE, ) with open(path) as fp: match = version_pattern.search(fp.read()) if match is None: raise ValueError('Could not find __version__ string in %s', path) - # E.g. '0.1.2', '0.1.3dev' + # e.g. '0.1.2', '0.1.3dev', '0.1.4a1' return '.'.join(str(part) for part in match.groups() if part)