jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1361352?usp=email )
Change subject: next_version: support ``next`` in all version references
......................................................................
next_version: support ``next`` in all version references
This includes deprecation decorators and deprecation warning function.
Change-Id: I102d7ad6120f77a7f317d55ca9d51949dec8f71b
---
M scripts/maintenance/next_version.py
1 file changed, 18 insertions(+), 7 deletions(-)
Approvals:
Mahveotm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/maintenance/next_version.py
b/scripts/maintenance/next_version.py
index ae0e3a4..c980539 100755
--- a/scripts/maintenance/next_version.py
+++ b/scripts/maintenance/next_version.py
@@ -4,17 +4,23 @@
#
# Distributed under the terms of the MIT license.
#
-"""Replace ``next`` in version directives with the release version.
+"""Replace ``next`` in version references with the release version.
-This script allows ``next`` in documentation version directives to
-target the upcoming release of the current branch::
+This script allows ``next`` as a placeholder for the upcoming release
+version in documentation directives and deprecation markers::
.. version-added:: next
.. version-changed:: next
.. version-deprecated:: next
.. version-removed:: next
+ @deprecated_args(module='module_name') # since next
+ @deprecated_signature(since='next')
+ issue_deprecation_warning('Passing arguments', since='next')
+
.. version-added:: 11.10
+.. version-changed:: 12.0
+ Support ``next`` in all version references.
"""
from __future__ import annotations
@@ -29,6 +35,7 @@
DIRECTIVE_RE = re.compile(
r'(version-(?:added|changed|removed|deprecated):: )next\b'
)
+SINCE_RE = re.compile(r"((?:\bsince='|# since ))next\b")
ROOT = Path(__file__).resolve().parents[2]
@@ -48,15 +55,19 @@
def fix_file(path: Path, version: str) -> int:
- """Replace ``next`` in version directives and return the change count."""
+ """Replace ``next`` in version references and return the change count."""
if path == Path(__file__).resolve(): # exclude this script
return 0
text = path.read_text(encoding='utf-8')
- updated, count = DIRECTIVE_RE.subn(r'\g<1>' + version, text)
+
+ count = 0
+ for regex in (DIRECTIVE_RE, SINCE_RE):
+ text, replacements = regex.subn(r'\g<1>' + version, text)
+ count += replacements
if count:
- path.write_text(updated, encoding='utf-8')
+ path.write_text(text, encoding='utf-8')
pywikibot.info(
f'Updated {path.relative_to(ROOT)} ({count} replacements)')
@@ -81,7 +92,7 @@
paths.extend((ROOT / directory).rglob('*.py'))
total = sum(fix_file(path, version) for path in paths)
- pywikibot.info(f'Updated {total} version directives to {version}.')
+ pywikibot.info(f'Updated {total} version references to {version}.')
if __name__ == '__main__':
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1361352?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I102d7ad6120f77a7f317d55ca9d51949dec8f71b
Gerrit-Change-Number: 1361352
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Mahveotm <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]