Beispiel #1
0
def _add_leading_zeroes_to_prerelease(label_tuple):
    if label_tuple is None:
        return None
    res = []
    for component in label_tuple:
        if component.isdigit():
            if len(component) > MAX_NUMERIC_PRERELEASE_LENGTH:
                reason = _("Prerelease numeric component is too large "
                           "(%d characters "
                           "max)") % MAX_NUMERIC_PRERELEASE_LENGTH
                raise exception.InvalidVersion(reason=reason)
            res.append(component.rjust(MAX_NUMERIC_PRERELEASE_LENGTH, '0'))
        else:
            res.append(component)
    return '.'.join(res)
Beispiel #2
0
def _check_limit(value):
    if value > MAX_COMPONENT_LENGTH:
        reason = _("Version component is too "
                   "large (%d max)") % MAX_COMPONENT_LENGTH
        raise exception.InvalidVersion(reason=reason)