def check_for_sdk_updates(auto_update_prompt=False): try: theirs = get_latest_version() yours = config.VERSION except LatestVersionCheckError: return if theirs <= yours: return url = 'https://github.com/grow/grow/releases/tag/{}'.format(theirs) logging.info('') logging.info(' Please update to the newest version of the Grow SDK.') logging.info(' See release notes: {}'.format(url)) logging.info(' Your version: {}, latest version: {}'.format( colorize(yours, ansi=226), colorize(theirs, ansi=82))) if utils.is_packaged_app() and auto_update_prompt: if raw_input('Auto update now? [y/N]: ').lower() != 'y': return if subprocess.call(INSTALLER_COMMAND, shell=True) == 0: logging.info('Restarting...') os.execl(sys.argv[0], *sys.argv) # Restart on successful install. else: text = ('In-place update failed. Update manually or use:\n' ' curl https://install.grow.io | bash') logging.error(text) sys.exit(-1) else: logging.info(' Update using: ' + colorize('pip install --upgrade grow', ansi=200)) print ''
def check_for_sdk_updates(auto_update_prompt=False): try: theirs = get_latest_version() yours = config.VERSION except LatestVersionCheckError: return if theirs <= yours: return url = 'https://github.com/grow/grow/releases/tag/{}'.format(theirs) logging.info('') logging.info(' Please update to the newest version of the Grow SDK.') logging.info(' See release notes: {}'.format(url)) logging.info(' Your version: {}, latest version: {}'.format( colorize(yours, ansi=226), colorize(theirs, ansi=82))) if utils.is_packaged_app() and auto_update_prompt: # If the installation was successful, restart the process. try: if (raw_input('Auto update now? [y/N]: ').lower() == 'y' and subprocess.call(INSTALLER_COMMAND, shell=True) == 0): logging.info('Restarting...') os.execl(sys.argv[0], *sys.argv) except Exception as e: text = ( 'In-place update failed. Update manually or use:\n' ' curl https://install.growsdk.org | bash') logging.error(text) sys.exit(-1) else: logging.info(' Update using: ' + colorize('pip install --upgrade grow', ansi=200)) print ''
def check_for_sdk_updates(auto_update_prompt=False): try: theirs = get_latest_version() yours = get_this_version() except LatestVersionCheckError: return if semantic_version.Version(theirs) <= semantic_version.Version(yours): return url = 'https://github.com/grow/grow/releases/tag/{}'.format(theirs) logging.info('') logging.info(' Please update to the newest version of the Grow SDK.') logging.info(' See release notes: {}'.format(url)) logging.info(' Your version: {}, latest version: {}'.format( colorize(yours, ansi=226), colorize(theirs, ansi=82))) if utils.is_packaged_app() and auto_update_prompt: rc_config = get_rc_config() use_auto_update = rc_config.get('update', {}).get('always', False) if use_auto_update: logging.info(' > Auto-updating to version: {}'.format( colorize(theirs, ansi=82))) else: choice = raw_input( 'Auto update now? [Y]es / [n]o / [a]lways: ').strip().lower() if choice not in ('y', 'a', ''): return if choice == 'a': rc_config['update'] = { 'always': True, } write_rc_config(rc_config) if subprocess.call(INSTALLER_COMMAND, shell=True) == 0: logging.info('Restarting...') os.execl(sys.argv[0], *sys.argv) # Restart on successful install. else: text = ('In-place update failed. Update manually or use:\n' ' curl https://install.grow.io | bash') logging.error(text) sys.exit(-1) else: logging.info(' Update using: ' + colorize('pip install --upgrade grow', ansi=200)) print ''
def check_version(auto_update_prompt=False): try: theirs = get_latest_version() yours = config.VERSION except LatestVersionCheckError: return if theirs > yours: logging.info('---') logging.info(utils.colorize('{green}Your version: %s,{/green} {yellow}latest version: %s{/yellow}' % (yours, theirs))) logging.info('A newer version of the SDK is available, so please update yours. See http://growsdk.org.') if utils.is_packaged_app() and auto_update_prompt: # If the installation was successful, restart the process. if (raw_input('Auto update now? [y/N]: ').lower() == 'y' and subprocess.call(INSTALLER_COMMAND, shell=True) == 0): logging.info('Restarting...') os.execl(sys.argv[0], *sys.argv) else: logging.info('Update using: pip install --upgrade grow') logging.info('---') else: logging.info('You have the latest version: {}'.format(yours))
def check_version(auto_update_prompt=False): try: theirs = get_latest_version() yours = config.VERSION except LatestVersionCheckError: return if theirs <= yours: return print '' print ' Please update to the newest version of the SDK. See http://growsdk.org.' print ' Your version: {}, latest version: {}'.format( colorize(yours, ansi=226), colorize(theirs, ansi=226)) if utils.is_packaged_app() and auto_update_prompt: # If the installation was successful, restart the process. if (raw_input('Auto update now? [y/N]: ').lower() == 'y' and subprocess.call(INSTALLER_COMMAND, shell=True) == 0): logging.info('Restarting...') os.execl(sys.argv[0], *sys.argv) else: print ' Update using: ' + colorize('pip install --upgrade grow', ansi=200) print ''
def check_for_updates(self, auto_update_prompt=False, force=False): """Check for updates to the sdk.""" grow_rc_config = rc_config.RC_CONFIG # Rate limited update checks. if not grow_rc_config.needs_update_check and not force: return try: sem_current = semantic_version.Version(self.current_version) sem_latest = semantic_version.Version(self.latest_version) # Mark that we have performed a check for the update. grow_rc_config.reset_update_check() grow_rc_config.write() except LatestVersionCheckError: return if sem_latest <= sem_current: return url = TAGS_URL_FORMAT.format(self.latest_version) logging.info('') logging.info(' Please update to the newest version of the Grow SDK.') logging.info(' Release notes: {}'.format(url)) logging.info(' Your version: {}, latest version: {}'.format( colors.stylize(str(sem_current), colors.EMPHASIS), colors.stylize(str(sem_latest), colors.EMPHASIS))) if utils.is_packaged_app() and auto_update_prompt: use_auto_update = grow_rc_config.get('update.always', False) if use_auto_update: logging.info(' > Auto-updating to version: {}'.format( colors.stylize(str(sem_latest), colors.HIGHLIGHT))) else: # pragma: no cover try: choice = raw_input( 'Auto update now? [Y]es / [n]o / [a]lways: ').strip( ).lower() except KeyboardInterrupt: choice = 'n' if choice not in ('y', 'a', ''): return if choice == 'a': grow_rc_config.set('update.always', True) grow_rc_config.write() if subprocess.call(INSTALLER_COMMAND, shell=True) == 0: logging.info('Restarting...') try: # Restart on successful install. os.execl(sys.argv[0], *sys.argv) except OSError: logging.info( 'Unable to restart. Please manually restart grow.') sys.exit(-1) else: text = ('In-place update failed. Update manually or use:\n' ' curl https://install.grow.io | bash') logging.error(text) sys.exit(-1) else: install_command = colors.stylize('pip install --upgrade grow', colors.CAUTION) logging.info(' Update using: {}'.format(install_command)) logging.info('') return True