def main(args=None):
    """
    main script
    """
    # Test if the COHORTE_HOME environment variable is set. If not exit
    cohorte_home = os.environ.get('COHORTE_HOME')
    if not cohorte_home:
        print("[ERROR] environment variable COHORTE_HOME not set")
        return 1

    # get real path (not symbolic files) # MOD_BD_20150825 #37
    global COHORTE_HOME
    COHORTE_HOME = os.path.realpath(cohorte_home)

    if not args:
        args = sys.argv[1:]

    # Define arguments
    parser = argparse.ArgumentParser(description="Cohorte Update Utility")

    group = parser.add_argument_group("Rollback options")

    group.add_argument("-r",
                       "--roll-back",
                       action="store_true",
                       dest="roll_back",
                       help="Rollback the last update/upgrade")

    # Parse arguments
    args = parser.parse_args(args)
    if args.roll_back:
        return roll_back()

    # get installed version
    installed = {}
    installed = common.get_installed_dist_info(COHORTE_HOME)
    common.show_installed_dist_info(installed)

    # get latest versions
    latest_dev = {}
    latest_release = {}
    latest_dev, latest_release = get_latest_dist_info(
        installed["distribution"])

    # compare actual version with latest
    result = analyse_versions(installed, latest_dev, latest_release)
    if result == UPGRADE:
        print("[INFO] There is a new 'release' version!")
        return upgrade(latest_release)
    elif result == UPDATE:
        print("[INFO] There is a new 'development' version!")
        return update(latest_dev)
    elif result == UPDATE_EXPERIMENTAL:
        print("[INFO] There is a new 'development/experimental' version!")
        return update_experimental(latest_dev)
    elif result == UPTODATE:
        return uptodate()

    return 0
def main(args=None):
    """
    main script
    """
    # Test if the COHORTE_HOME environment variable is set. If not exit
    cohorte_home = os.environ.get("COHORTE_HOME")
    if not cohorte_home:
        print("[ERROR] environment variable COHORTE_HOME not set")
        return 1

    # get real path (not symbolic files) # MOD_BD_20150825 #37
    global COHORTE_HOME
    COHORTE_HOME = os.path.realpath(cohorte_home)

    if not args:
        args = sys.argv[1:]

    # Define arguments
    parser = argparse.ArgumentParser(description="Cohorte Update Utility")

    group = parser.add_argument_group("Rollback options")

    group.add_argument(
        "-r", "--roll-back", action="store_true", dest="roll_back", help="Rollback the last update/upgrade"
    )

    # Parse arguments
    args = parser.parse_args(args)
    if args.roll_back:
        return roll_back()

    # get installed version
    installed = {}
    installed = common.get_installed_dist_info(COHORTE_HOME)
    common.show_installed_dist_info(installed)

    # get latest versions
    latest_dev = {}
    latest_release = {}
    latest_dev, latest_release = get_latest_dist_info(installed["distribution"])

    # compare actual version with latest
    result = analyse_versions(installed, latest_dev, latest_release)
    if result == UPGRADE:
        print("[INFO] There is a new 'release' version!")
        return upgrade(latest_release)
    elif result == UPDATE:
        print("[INFO] There is a new 'development' version!")
        return update(latest_dev)
    elif result == UPDATE_EXPERIMENTAL:
        print("[INFO] There is a new 'development/experimental' version!")
        return update_experimental(latest_dev)
    elif result == UPTODATE:
        return uptodate()

    return 0
def main(args=None):
    """
    main script
    """
    # Test if the COHORTE_HOME environment variable is set. If not exit
    COHORTE_HOME = os.environ.get('COHORTE_HOME')
    if not COHORTE_HOME:
        print("[ERROR] environment variable COHORTE_HOME not set")
        return 1
    # Show actual version
    actual = common.get_installed_dist_info(COHORTE_HOME)
    common.show_installed_dist_info(actual)
    return 0
Esempio n. 4
0
def main(args=None):
    """
    main script
    """
    # Test if the COHORTE_HOME environment variable is set. If not exit
    COHORTE_HOME = os.environ.get('COHORTE_HOME')
    if not COHORTE_HOME:
        print("[ERROR] environment variable COHORTE_HOME not set")
        return 1
    # Show actual version
    actual = common.get_installed_dist_info(COHORTE_HOME)
    common.show_installed_dist_info(actual)
    return 0