(from_version, to_version)
return scripts
Give the current installed version, calculate which upgrade scripts we need
    to run to upgrade it to the latest verison.

    For example, given current version 5.0.1 and target version 6.1.0, and these
    upgrade scripts:

        upgrade_4.4_5.0.sh
        upgrade_5.0_5.1.sh
        upgrade_5.1_6.0.sh
        upgrade_6.0_6.1.sh

    We need to run upgrade_5.0_5.1.sh, upgrade_5.1_6.0.sh, and upgrade_6.0_6.1.sh.
Give the current installed version, calculate which upgrade scripts we need
    to run to upgrade it to the latest verison.
Give the current installed version calculate which upgrade scripts we need to run to upgrade it to the latest verison .
def collect_upgrade_scripts(from_version, to_version):
    """
    Give the current installed version, calculate which upgrade scripts we need
    to run to upgrade it to the latest verison.

    For example, given current version 5.0.1 and target version 6.1.0, and these
    upgrade scripts:

        upgrade_4.4_5.0.sh
        upgrade_5.0_5.1.sh
        upgrade_5.1_6.0.sh
        upgrade_6.0_6.1.sh

    We need to run upgrade_5.0_5.1.sh, upgrade_5.1_6.0.sh, and upgrade_6.0_6.1.sh.
    """
    from_major_ver = '.'.join(from_version.split('.')[:2])
    to_major_ver = '.'.join(to_version.split('.')[:2])

    scripts = []
    for fn in sorted(glob.glob(join(installdir, 'upgrade', 'upgrade_*_*.sh'))):
        va, vb = parse_upgrade_script_version(fn)
        if va >= from_major_ver and vb <= to_major_ver:
            scripts.append(fn)
    return scripts
def collect_upgrade_scripts ( from_version , to_version ) : from_major_ver = '.' . join ( from_version . split ( '.' ) [ : 2 ] ) to_major_ver = '.' . join ( to_version . split ( '.' ) [ : 2 ] ) scripts = [ ] for fn in sorted ( glob . glob ( join ( installdir , 'upgrade' , 'upgrade_*_*.sh' ) ) ) : va , vb = parse_upgrade_script_version ( fn ) if va >= from_major_ver and vb <= to_major_ver : scripts . append ( fn ) return scripts