Skip to content

Commit

Permalink
Merge pull request #2044 from hodgestar/feature/v5-simplify-version-p…
Browse files Browse the repository at this point in the history
…arsing

Simplify version parsing (v5).
  • Loading branch information
hodgestar committed Dec 10, 2022
2 parents 169b000 + 2fc35ba commit 53e614d
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,7 @@ def _determine_version(options):
version_filename = os.path.join(options['rootdir'], 'VERSION')
with open(version_filename, "r") as version_file:
version_string = version_file.read().strip()
version = packaging.version.parse(version_string)
# LegacyVersion was removed in packaging 22, but is still returned by
# packing <= 21
LegacyVersion = getattr(packaging.version, "LegacyVersion", type(None))
if isinstance(version, LegacyVersion):
raise ValueError("invalid version: " + version_string)
version = packaging.version.Version(version_string)
options['short_version'] = str(version.public)
options['release'] = not version.is_devrelease
if not options['release']:
Expand Down

0 comments on commit 53e614d

Please sign in to comment.