wip: refuctoring on the road to v201812

This commit is contained in:
Manuel Barkhau 2018-12-05 09:38:27 +01:00
parent 70f4e01104
commit fe06833764
5 changed files with 468 additions and 302 deletions

View file

@ -6,6 +6,7 @@
"""Functions related to version string manipulation."""
import logging
import pkg_resources
import typing as typ
import datetime as dt
@ -29,7 +30,7 @@ def incr(old_version: str, *, release: str = None) -> str:
Old_version is assumed to be a valid calver string,
already validated in pycalver.config.parse.
"""
old_ver = parse.VersionInfo.parse(old_version)
old_ver = parse.parse_version_info(old_version)
new_calver = current_calver()
@ -60,3 +61,12 @@ def incr(old_version: str, *, release: str = None) -> str:
if new_release:
new_version += "-" + new_release
return new_version
def pycalver_to_pep440(version: str) -> str:
"""Derive pep440 compliant version string from PyCalVer version string.
>>> pycalver_to_pep440("v201811.0007-beta")
'201811.7b0'
"""
return str(pkg_resources.parse_version(version))