mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 14:30:09 +01:00
Fix #200 - Use looseversion if pkg_resources doesn't work
This commit is contained in:
parent
ffe28e6fff
commit
8dc594c055
3 changed files with 18 additions and 3 deletions
|
|
@ -1,5 +1,12 @@
|
||||||
# Changelog for https://github.com/mbarkhau/bumpver
|
# Changelog for https://github.com/mbarkhau/bumpver
|
||||||
|
|
||||||
|
## BumpVer 2023.1121
|
||||||
|
|
||||||
|
- Fix [#200][gh_i200]: Fix compatability with packaging 23.0.
|
||||||
|
|
||||||
|
[gh_i200]: https://github.com/mbarkhau/bumpver/issues/200
|
||||||
|
|
||||||
|
|
||||||
## BumpVer 2022.1120
|
## BumpVer 2022.1120
|
||||||
|
|
||||||
- Fix [#196][gh_i196]: Add `--pin-increments`.
|
- Fix [#196][gh_i196]: Add `--pin-increments`.
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@ toml
|
||||||
lexid
|
lexid
|
||||||
colorama>=0.4
|
colorama>=0.4
|
||||||
|
|
||||||
|
# looseversion is needed to parse non PEP440 versions
|
||||||
|
looseversion; python_version >= "3.5"
|
||||||
|
|
||||||
# setuptools is needed for pkg_resources.parse_version
|
# setuptools is needed for pkg_resources.parse_version
|
||||||
# Support for Python 2 was dropped with v45
|
# Support for Python 2 was dropped with v45
|
||||||
setuptools<45.0.0; python_version < "3.5"
|
setuptools<45.0.0; python_version < "3.5"
|
||||||
setuptools>=45.0.0; python_version >= "3.5"
|
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,15 @@ MaybeInt = typ.Optional[int]
|
||||||
|
|
||||||
def parse_version(version: str) -> typ.Any:
|
def parse_version(version: str) -> typ.Any:
|
||||||
# pylint: disable=import-outside-toplevel; lazy import to speed up --help
|
# pylint: disable=import-outside-toplevel; lazy import to speed up --help
|
||||||
|
|
||||||
|
try:
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
return pkg_resources.parse_version(version)
|
return pkg_resources.parse_version(version)
|
||||||
|
except (ImportError, pkg_resources.extern.packaging.version.InvalidVersion):
|
||||||
|
import looseversion
|
||||||
|
|
||||||
|
return looseversion.LooseVersion(version)
|
||||||
|
|
||||||
|
|
||||||
class V1CalendarInfo(typ.NamedTuple):
|
class V1CalendarInfo(typ.NamedTuple):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue