metadata: normalize version via CargoSemVer

This commit is contained in:
Alberto Planas 2019-10-30 17:28:32 +01:00
parent fcbf95a78e
commit 23e807d8ce

View file

@ -220,10 +220,10 @@ class Metadata:
def __init__(self, name, version): def __init__(self, name, version):
self.name = name self.name = name
self._version = version self._version = version
version_normalized = Dependency._normalize_req(f"={self._version}") version_normalized = CargoSemVer.unparse_version(
if len(version_normalized) != 1: CargoSemVer.coerce(
raise Exception(f"Incorrect version: {self._version}") CargoSemVer.parse_version(self._version)))
self.version = version_normalized[0][1] self.version = version_normalized
self.license = None self.license = None
self.license_file = None self.license_file = None
self.readme = None self.readme = None