def check_latest_version(): """ checks for the latest version of cumulusci from pypi, max once per hour """ check = True with timestamp_file() as f: timestamp = float(f.read() or 0) delta = time.time() - timestamp check = delta > 3600 if check: try: latest_version = get_latest_final_version() except requests.exceptions.RequestException as e: click.echo("Error checking cci version:") click.echo(str(e)) return result = latest_version > get_installed_version() click.echo("Checking the version!") if result: click.echo( """An update to CumulusCI is available. Use {} to update.""".format( get_cci_upgrade_command() ) )
def version(): click.echo("CumulusCI version: ", nl=False) click.echo(click.style(cumulusci.__version__, bold=True), nl=False) click.echo(" ({})".format(sys.argv[0])) click.echo("Python version: {}".format(sys.version.split()[0]), nl=False) click.echo(" ({})".format(sys.executable)) click.echo() current_version = get_installed_version() latest_version = get_latest_final_version() if latest_version > current_version: click.echo( "There is a newer version of CumulusCI available ({}).".format( str(latest_version))) click.echo("To upgrade, run `{}`".format(get_cci_upgrade_command())) click.echo( "Release notes: https://github.com/SFDO-Tooling/CumulusCI/releases/tag/v{}" .format(str(latest_version))) else: click.echo("You have the latest version of CumulusCI.") if sys.version_info.major == 2: click.echo() click.echo("WARNING: You are running CumulusCI using Python 2.") click.echo("Soon CumulusCI will only support Python 3.") click.echo( "To reinstall CumulusCI on Python 3, follow these instructions:") click.echo("https://cumulusci.readthedocs.io/en/latest/install.html") click.echo()
def version(): click.echo("CumulusCI version: ", nl=False) click.echo(click.style(cumulusci.__version__, bold=True), nl=False) click.echo(f" ({sys.argv[0]})") click.echo(f"Python version: {sys.version.split()[0]}", nl=False) click.echo(f" ({sys.executable})") click.echo() current_version = get_installed_version() latest_version = get_latest_final_version() if latest_version > current_version: click.echo( f"There is a newer version of CumulusCI available ({str(latest_version)})." ) click.echo(f"To upgrade, run `{get_cci_upgrade_command()}`") click.echo( f"Release notes: https://github.com/SFDO-Tooling/CumulusCI/releases/tag/v{str(latest_version)}" ) else: click.echo("You have the latest version of CumulusCI.") click.echo()
def check_latest_version(): """ checks for the latest version of cumulusci from pypi, max once per hour """ check = True with dbm_cache() as cache: if "cumulusci-latest-timestamp" in cache: delta = time.time() - float(cache["cumulusci-latest-timestamp"]) check = delta > 3600 if check: try: latest_version = get_latest_version() except requests.exceptions.RequestException as e: click.echo("Error checking cci version:") click.echo(e.message) return result = latest_version > get_installed_version() click.echo("Checking the version!") if result: click.echo( "An update to CumulusCI is available. Use pip install --upgrade cumulusci to update." )