Skip to content

Commit

Permalink
versioning: swap minor/patch inc default, allow manual override
Browse files Browse the repository at this point in the history
  • Loading branch information
mara004 committed May 18, 2024
1 parent 38f5efe commit d8a3128
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -776,14 +776,7 @@ The autorelease script has some peculiarities maintainers should know about:
On release, it will be moved into the main changelog under `docs/source/changelog.md`, annotated with the PDFium version update.
It will also be shown on the GitHub release page.
* pypdfium2 versioning uses the pattern `major.minor.patch`, optionally with an appended beta mark (e. g. `2.7.1`, `2.11.0`, `3.0.0b1`, ...).
Version changes are based on the following logic:
* If PDFium was updated, the minor version is incremented.
* If only pypdfium2 code was updated, the patch version is incremented instead.
* Major updates and beta marks are controlled via `autorelease/config.json`.
If `major` is true, the major version is incremented.
If `beta` is true, a new beta tag is set, or an existing one is incremented.
The control file is automatically reset when the versioning is finished.
* If switching from a beta release to a non-beta release, only the beta mark is removed while minor and patch versions remain unchanged.
Update types such as major or beta may be controlled via `autorelease/config.json`

In case of necessity, you may also forego autorelease/CI and do the release manually, which will roughly work like this (though ideally it should never be needed):
* Commit changes to the version file
Expand Down
3 changes: 2 additions & 1 deletion autorelease/config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"beta": false,
"major": false
"major": false,
"humble": null
}
2 changes: 2 additions & 0 deletions docs/devel/changelog_staging.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
<!-- List character: dash (-) -->

# Changelog for next release
- `PdfPage.get_objects()`: Don't register pageobjects as children, because they don't need to be closed by the caller when part of a page. This avoids excessive caching of weakrefs that are not cleaned up with the object they refer to.
- Autorelease: Swapped default condition for minor/patch update, as pypdfium2 changes are likely more API-significant than pdfium updates. Added ability for manual override.
11 changes: 7 additions & 4 deletions setupsrc/pypdfium2_setup/autorelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ def do_versioning(config, record, prev_helpers, new_pdfium):
if prev_helpers["dirty"]:
print("Warning: dirty state. This should not happen in CI.", file=sys.stderr)

c_updates = record["pdfium"] < new_pdfium
# TODO actually, we care only about updates to src/
py_updates = prev_helpers["n_commits"] > 0
c_updates = record["pdfium"] < new_pdfium

if not c_updates and not py_updates:
print("Warning: Neither pypdfium2 code nor pdfium-binaries updated. New release pointless?", file=sys.stderr)
Expand All @@ -54,14 +55,16 @@ def do_versioning(config, record, prev_helpers, new_pdfium):
new_config["major"] = False
elif prev_helpers["beta"] is None:
# If we're not doing a major update and the previous version was not a beta, update minor and/or patch. Note that we still want to run this if adding a new beta tag.
if c_updates:
# pdfium update -> increment minor version and reset patch version
if (py_updates and not config["humble"]) or config["humble"] is False:
# py code update, or manually requested minor release -> increment minor version and reset patch version
new_helpers["minor"] += 1
new_helpers["patch"] = 0
else:
# no pdfium update -> increment patch version
# no py code update, or manually requested patch release -> increment patch version
new_helpers["patch"] += 1

if config["humble"] is not None:
new_config["humble"] = None
if config["beta"]:
# If the new version shall be a beta, set or increment the tag
if new_helpers["beta"] is None:
Expand Down

0 comments on commit d8a3128

Please sign in to comment.