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):
self.name = name
self._version = version
version_normalized = Dependency._normalize_req(f"={self._version}")
if len(version_normalized) != 1:
raise Exception(f"Incorrect version: {self._version}")
self.version = version_normalized[0][1]
version_normalized = CargoSemVer.unparse_version(
CargoSemVer.coerce(
CargoSemVer.parse_version(self._version)))
self.version = version_normalized
self.license = None
self.license_file = None
self.readme = None