Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Changelog of tags2sdists
2.5.3 (unreleased)
------------------

- Nothing changed yet.
- Added ``--allow-prereleases`` option. Previously, we always skipped alpha/beta tags
like ``0.1b1``. With the new option, they're included.


2.5.2 (2025-03-05)
Expand Down
17 changes: 11 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,20 @@ Tags2sdists provides the ``tags2sdists`` command::
SDISTDIR: directory with sdist package directories

Options:
-a, --build-all Build all releases (=don't stop if the newest tag is found)
-h, --help Show this help message and exit
-v, --verbose Show debug output
-q, --quiet Show minimal output

Witn ``--build-all``, all the tags are build. The default behaviour helps with
-h, --help show this help message and exit
-v, --verbose Show debug output
-q, --quiet Show minimal output
-a, --build-all Build all releases (=don't stop if the newest tag is
found)
-p, --allow-prereleases
Allow prereleases (=tags like 0.1b1 or 2.0a3)

With ``--build-all``, all the tags are build. The default behaviour helps with
mis-behaving old tags, but if all the packages are clean, ``--build-all`` is a
good choice as also bugfix releases for older versions are build.

And ``--allow-prereleases`` builds alpha/beta/rc packages instead of skipping them.


Setup
-----
Expand Down
6 changes: 4 additions & 2 deletions src/tags2sdists/checkoutdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def __init__(self, directory):
self.wrapper.prepare() # zest.releaser requirement.
self.package = self.wrapper.vcs.name

def missing_tags(self, existing_sdists=None, build_all=False):
def missing_tags(
self, existing_sdists=None, build_all=False, allow_prereleases=False
):
"""Return difference between existing sdists and available tags."""
if existing_sdists is None:
existing_sdists = []
Expand All @@ -98,7 +100,7 @@ def missing_tags(self, existing_sdists=None, build_all=False):
available_tags = sorted_versions(available)
available_tags.reverse()
for tag in available_tags:
if tag.is_prerelease:
if tag.is_prerelease and not allow_prereleases:
logger.warning("Pre-release marker in tag: %s, ignoring", tag)
continue
if tag in existing_sdists:
Expand Down
9 changes: 9 additions & 0 deletions src/tags2sdists/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ def main():
default=False,
help="Build all releases (=don't stop if the newest tag is found)",
)
parser.add_option(
"-p",
"--allow-prereleases",
action="store_true",
dest="allow_prereleases",
default=False,
help="Allow prereleases (=tags like 0.1b1 or 2.0a3)",
)
(options, args) = parser.parse_args()

if len(args) != 2:
Expand Down Expand Up @@ -76,6 +84,7 @@ def main():
for tag in checkout_dir.missing_tags(
existing_sdists=package_dir.packages[package],
build_all=options.build_all,
allow_prereleases=options.allow_prereleases,
):
tarballs = checkout_dir.create_sdists(tag)
for tarball in tarballs:
Expand Down
Loading