def _check_newer_major(current_highest, versions):
    """
    Utility function for checking whether a new version exists and is not going
    to be updated. This is undesirable because it could result in new versions
    existing and not being updated. Raising is prefering to adding the new
    version manually because that allows maintainers to check whether the new
    version works.
    @param current_highest: as returned by VersionsFile.highest_version_major()
    @param versions: a list of versions.
    @return: void
    @raise MissingMajorException: A new version from a newer major branch is
        exists, but will not be downloaded due to it not being in majors.
    """
    for tag in versions:
        update_majors = list(current_highest.keys())
        example_version_str = current_highest[update_majors[0]]
        if _tag_is_rubbish(tag, example_version_str):
            continue

        major = tag[0:len(update_majors[0])]
        if major not in current_highest:
            higher_version_present = False
            for major_highest in current_highest:
                if version_gt(major_highest, major):
                    higher_version_present = True
                    break

            if not higher_version_present:
                msg = 'Failed updating: Major %s has a new version and is not going to be updated.' % major
                raise MissingMajorException(msg)
Beispiel #2
0
def _newer_tags_get(current_highest, versions):
    """
    Returns versions from versions which are greater than than the highest
    version in each major. Note that a major must be in current_highest
    in order for versions of that major branch to appear in the return.
    @param current_highest: as returned by VersionsFile.highest_version_major()
    @param versions: a list of versions.
    @return: a list of versions.
    """
    newer = []
    for major in current_highest:
        highest_version = current_highest[major]
        for version in versions:
            if version.startswith(major) and version_gt(version,
                    highest_version):
                newer.append(version)

    return newer
Beispiel #3
0
def _newer_tags_get(current_highest, versions):
    """
    Returns versions from versions which are greater than than the highest
    version in each major. Note that a major must be in current_highest
    in order for versions of that major branch to appear in the return.
    @param current_highest: as returned by VersionsFile.highest_version_major()
    @param versions: a list of versions.
    @return: a list of versions.
    """
    newer = []
    for major in current_highest:
        highest_version = current_highest[major]
        for version in versions:
            if version.startswith(major) and version_gt(
                    version, highest_version):
                newer.append(version)

    return newer
Beispiel #4
0
def _newer_tags_get(current_highest, versions):
    """
    Returns versions from versions which are greater than than the highest
    version in each major. If a newer major is present in versions which is
    not present on current_highest, an exception will be raised.
    @param current_highest: as returned by VersionsFile.highest_version_major()
    @param versions: a list of versions.
    @return: a list of versions.
    @raise MissingMajorException: A new version from a newer major branch is
        exists, but will not be downloaded due to it not being in majors.
    """
    newer = []
    for major in current_highest:
        highest_version = current_highest[major]
        for version in versions:
            if version.startswith(major) and version_gt(
                    version, highest_version):
                newer.append(version)

    _check_newer_major(current_highest, versions)

    return newer
Beispiel #5
0
def _newer_tags_get(current_highest, versions):
    """
    Returns versions from versions which are greater than than the highest
    version in each major. If a newer major is present in versions which is
    not present on current_highest, an exception will be raised.
    @param current_highest: as returned by VersionsFile.highest_version_major()
    @param versions: a list of versions.
    @return: a list of versions.
    @raise MissingMajorException: A new version from a newer major branch is
        exists, but will not be downloaded due to it not being in majors.
    """
    newer = []
    for major in current_highest:
        highest_version = current_highest[major]
        for version in versions:
            version = version.lstrip('v')
            if version.startswith(major) and version_gt(version,
                    highest_version):
                newer.append(version)

    _check_newer_major(current_highest, versions)

    return newer
 def version_gt(self, version, gt):
     return version_gt(version, gt)
Beispiel #7
0
 def version_gt(self, version, gt):
     return version_gt(version, gt)