def perform_check(prerelease=current_version.is_prerelease):
 pypi = current_version
 try:
  pypi = available_on_pypi(prerelease)
 except Exception:
  log.warning('An issue occurred while checking PyPI')
 best = max(pypi, current_version)
 where = None
 command = None
 cache = cache_file()
 if cache:
  os.utime(cache, None)
 if (best == current_version):
  log.info(('You have the latest version of Pwntools (%s)' % best))
  return
 command = ['pip', 'install', '-U']
 if (best == pypi):
  where = 'pypi'
  pypi_package = package_name
  if best.is_prerelease:
   pypi_package += ('==%s' % best)
  command += [pypi_package]
 command_str = ' '.join(command)
 log.info((('A newer version of %s is available on %s (%s --> %s).\n' % (package_name, where, current_version, best)) + ('Update with: $ %s' % command_str)))
 return command

def perform_check ( prerelease = current_version . is_prerelease ) : pypi = current_version try : pypi = available_on_pypi ( prerelease ) except Exception : log . warning ( 'An issue occurred while checking PyPI' ) best = max ( pypi , current_version ) where = None command = None cache = cache_file ( ) if cache : os . utime ( cache , None ) if ( best == current_version ) : log . info ( ( 'You have the latest version of Pwntools (%s)' % best ) ) return command = [ 'pip' , 'install' , '-U' ] if ( best == pypi ) : where = 'pypi' pypi_package = package_name if best . is_prerelease : pypi_package += ( '==%s' % best ) command += [ pypi_package ] command_str = ' ' . join ( command ) log . info ( ( ( 'A newer version of %s is available on %s (%s --> %s).\n' % ( package_name , where , current_version , best ) ) + ( 'Update with: $ %s' % command_str ) ) ) return command
perform the update check .