From d8a3128caabf0f2f25c7bdd7cd4b93a4dc35fac2 Mon Sep 17 00:00:00 2001 From: geisserml Date: Sun, 19 May 2024 00:40:41 +0200 Subject: [PATCH] versioning: swap minor/patch inc default, allow manual override --- README.md | 9 +-------- autorelease/config.json | 3 ++- docs/devel/changelog_staging.md | 2 ++ setupsrc/pypdfium2_setup/autorelease.py | 11 +++++++---- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d052a55d1..628da8ad4 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/autorelease/config.json b/autorelease/config.json index 7f0e24f9f..d6a9c8477 100644 --- a/autorelease/config.json +++ b/autorelease/config.json @@ -1,4 +1,5 @@ { "beta": false, - "major": false + "major": false, + "humble": null } \ No newline at end of file diff --git a/docs/devel/changelog_staging.md b/docs/devel/changelog_staging.md index e41edd85a..7d1bd5f3e 100644 --- a/docs/devel/changelog_staging.md +++ b/docs/devel/changelog_staging.md @@ -4,3 +4,5 @@ # 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. diff --git a/setupsrc/pypdfium2_setup/autorelease.py b/setupsrc/pypdfium2_setup/autorelease.py index 520f712c4..5a8d3a537 100644 --- a/setupsrc/pypdfium2_setup/autorelease.py +++ b/setupsrc/pypdfium2_setup/autorelease.py @@ -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) @@ -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: