diff options
| author | Adam Turner <9087854+AA-Turner@users.noreply.github.com> | 2022-04-16 21:38:39 +0100 |
|---|---|---|
| committer | Adam Turner <9087854+AA-Turner@users.noreply.github.com> | 2022-09-13 10:31:27 +0100 |
| commit | b34765780950a04a8a387b1cafa33bf99b704bde (patch) | |
| tree | 2ae15e6577b48a96a7aaba72d2bc2be4a394197c /utils | |
| parent | 5477ef6675247e1eeb0c7d3842fba41f59147e20 (diff) | |
| download | sphinx-git-b34765780950a04a8a387b1cafa33bf99b704bde.tar.gz | |
Use declarative metadata
- Move to pyproject.toml metadata
- Update references to `setup.py`
- Use pypa/build
- Update workflows and tooling
Diffstat (limited to 'utils')
| -rwxr-xr-x | utils/bump_version.py | 30 | ||||
| -rw-r--r-- | utils/release-checklist | 8 |
2 files changed, 21 insertions, 17 deletions
diff --git a/utils/bump_version.py b/utils/bump_version.py index aeaed864b..e2aefa842 100755 --- a/utils/bump_version.py +++ b/utils/bump_version.py @@ -23,19 +23,23 @@ def stringify_version(version_info, in_develop=True): def bump_version(path, version_info, in_develop=True): version = stringify_version(version_info, in_develop) - release = version - if in_develop: - version += '+' - - with open(path, 'r+', encoding='utf-8') as f: - body = f.read() - body = re.sub(r"(?<=__version__ = ')[^']+", version, body) - body = re.sub(r"(?<=__released__ = ')[^']+", release, body) - body = re.sub(r"(?<=version_info = )\(.*\)", str(version_info), body) - - f.seek(0) - f.truncate(0) - f.write(body) + + with open(path, 'r', encoding='utf-8') as f: + lines = f.read().splitlines() + + for i, line in enumerate(lines): + if line.startswith('__version__ = '): + lines[i] = f"__version__ = '{version}'" + continue + if line.startswith('version_info = '): + lines[i] = f'version_info = {version_info}' + continue + if line.startswith('_in_development = '): + lines[i] = f'_in_development = {in_develop}' + continue + + with open(path, 'w', encoding='utf-8') as f: + f.write('\n'.join(lines) + '\n') def parse_version(version): diff --git a/utils/release-checklist b/utils/release-checklist index 920c1ce8f..0d1733229 100644 --- a/utils/release-checklist +++ b/utils/release-checklist @@ -10,7 +10,7 @@ for stable releases * Check diff by ``git diff`` * ``git commit -am 'Bump to X.Y.Z final'`` * ``make clean`` -* ``python setup.py release bdist_wheel sdist`` +* ``python -m build .`` * ``twine upload dist/Sphinx-* --sign --identity [your GPG key]`` * open https://pypi.org/project/Sphinx/ and check there are no obvious errors * ``sh utils/bump_docker.sh X.Y.Z`` @@ -34,7 +34,7 @@ for first beta releases * Check diff by ``git diff`` * ``git commit -am 'Bump to X.Y.0 beta1'`` * ``make clean`` -* ``python setup.py release bdist_wheel sdist`` +* ``python -m build .`` * ``twine upload dist/Sphinx-* --sign --identity [your GPG key]`` * open https://pypi.org/project/Sphinx/ and check there are no obvious errors * ``git tag vX.Y.0b1`` @@ -62,7 +62,7 @@ for other beta releases * Check diff by ``git diff`` * ``git commit -am 'Bump to X.Y.0 betaN'`` * ``make clean`` -* ``python setup.py release bdist_wheel sdist`` +* ``python -m build .`` * ``twine upload dist/Sphinx-* --sign --identity [your GPG key]`` * open https://pypi.org/project/Sphinx/ and check there are no obvious errors * ``git tag vX.Y.0bN`` @@ -87,7 +87,7 @@ for major releases * Check diff by ``git diff`` * ``git commit -am 'Bump to X.Y.0 final'`` * ``make clean`` -* ``python setup.py release bdist_wheel sdist`` +* ``python -m build .`` * ``twine upload dist/Sphinx-* --sign --identity [your GPG key]`` * open https://pypi.org/project/Sphinx/ and check there are no obvious errors * ``sh utils/bump_docker.sh X.Y.Z`` |
