def version_info(self):
        """ Tell, what version we're running at and if it's up to date. """

        # Retrive and show local version info
        package = pkg.get_distribution('git-up')
        local_version_str = package.version
        local_version = package.parsed_version

        print('GitUp version is: ' + colored('v' + local_version_str, 'green'))

        if not self.settings['updates.check']:
            return

        # Check for updates
        print('Checking for updates...', end='')

        try:
            # Get version information from the PyPI JSON API
            reader = codecs.getreader('utf-8')
            details = json.load(reader(urlopen(PYPI_URL)))
            online_version = details['info']['version']
        except (HTTPError, URLError, ValueError):
            recent = True  # To not disturb the user with HTTP/parsing errors
        else:
            recent = local_version >= pkg.parse_version(online_version)

        if not recent:
            # noinspection PyUnboundLocalVariable
            print(
                '\rRecent version is: '
                + colored('v' + online_version, color='yellow', attrs=['bold'])
            )
            print('Run \'pip install -U git-up\' to get the update.')
        else:
            # Clear the update line
            sys.stdout.write('\r' + ' ' * 80 + '\n')
def version_info ( self ) : package = pkg . get_distribution ( 'git-up' ) local_version_str = package . version local_version = package . parsed_version print ( 'GitUp version is: ' + colored ( 'v' + local_version_str , 'green' ) ) if not self . settings [ 'updates.check' ] : return print ( 'Checking for updates...' , end = '' ) try : reader = codecs . getreader ( 'utf-8' ) details = json . load ( reader ( urlopen ( PYPI_URL ) ) ) online_version = details [ 'info' ] [ 'version' ] except ( HTTPError , URLError , ValueError ) : recent = True else : recent = local_version >= pkg . parse_version ( online_version ) if not recent : print ( '\rRecent version is: ' + colored ( 'v' + online_version , color = 'yellow' , attrs = [ 'bold' ] ) ) print ( 'Run \'pip install -U git-up\' to get the update.' ) else : sys . stdout . write ( '\r' + ' ' * 80 + '\n' )
Tell, what version we're running at and if it's up to date.