Skip to content

Commit

Permalink
setup.py: Remove custom version handling logic.
Browse files Browse the repository at this point in the history
This was actually already disabled when updating to newer versioneer
in commit feb4940, but is now further
obsoleted because BuildStream is now dropping the GNOME style version
notation and now follows semver more strictly.
  • Loading branch information
gtristan committed Aug 7, 2023
1 parent 4528654 commit 6c02517
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import re
import sys

import packaging.version


###################################
# Ensure we have a version number #
Expand All @@ -32,44 +30,6 @@
sys.path.append(os.path.dirname(__file__))
import versioneer # pylint: disable=wrong-import-position


def mark_unstable_version(version_string):
# When publishing to PyPI we must be sure that unstable releases are
# marked as such, so `pip install` doesn't install them by default.

v = packaging.version.parse(version_string)

# BuildStream version scheme: if MINOR version is odd, then
# this is an unstable release.
is_unstable_release = v.minor % 2 != 0

# Python PEP440 version scheme: use an explicit postfix to mark development
# and prereleases.
if is_unstable_release:
if v.local or v.is_devrelease or v.is_prerelease:
# PyPI will ignore these without us marking them.
return version_string
else:
return version_string + ".dev0"

return version_string


# Extend versioneer to support our custom version style.
_render = versioneer.render


def render_version(pieces, style):
if style == "pep440_buildstream":
result = _render(pieces, "pep440")
result["version"] = mark_unstable_version(result["version"])
else:
result = _render(pieces, style)
return result


versioneer.render = render_version

version = versioneer.get_version()

if version.startswith("0+untagged"):
Expand Down

0 comments on commit 6c02517

Please sign in to comment.