Example #1
0
 def _parse_version_str(version: str):
     m = re.fullmatch(MAJOR_MINOR_VERSION_RE, version)
     if not m:
         raise errors.InvalidVersionError(version)
     d = m.groupdict()
     return (d["major"], d["minor"] if d.get("minor") else None)
Example #2
0
 def _check_version_number(minor_or_major):
     if minor_or_major and not re.fullmatch("^[0-9]+$", minor_or_major):
         raise errors.InvalidVersionError(
             f"Invalid version `{minor_or_major}` is not a number")
Example #3
0
 def check_version_valid(cls, name: str):
     if name and not re.fullmatch(GENERIC_ASSET_VERSION_RE, name):
         raise errors.InvalidVersionError(
             f"Invalid version `{name}`, can only contain [a-zA-Z0-9], [-._]"
         )
Example #4
0
 def _check_major_version(major_version, minor_version):
     if minor_version and not major_version:
         raise errors.InvalidVersionError(
             "Cannot specify a minor version without a major version.")
Example #5
0
 def check_version_valid(cls, version: str):
     if not re.fullmatch(DATE_RE, version):
         raise errors.InvalidVersionError(f"Invalid version `{version}`")