def egg_info_matches(egg_info, search_name, link, _egg_info_re=re.compile('([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)):
 match = _egg_info_re.search(egg_info)
 if (not match):
  logger.debug('Could not parse version from link: %s', link)
  return None
 if (search_name is None):
  full_match = match.group(0)
  return full_match[full_match.index('-'):]
 name = match.group(0).lower()
 name = name.replace('_', '-')
 look_for = (search_name.lower() + '-')
 if name.startswith(look_for):
  return match.group(0)[len(look_for):]
 else:
  return None

def egg_info_matches ( egg_info , search_name , link , _egg_info_re = re . compile ( '([a-z0-9_.]+)-([a-z0-9_.!+-]+)' , re . I ) ) : match = _egg_info_re . search ( egg_info ) if ( not match ) : logger . debug ( 'Could not parse version from link: %s' , link ) return None if ( search_name is None ) : full_match = match . group ( 0 ) return full_match [ full_match . index ( '-' ) : ] name = match . group ( 0 ) . lower ( ) name = name . replace ( '_' , '-' ) look_for = ( search_name . lower ( ) + '-' ) if name . startswith ( look_for ) : return match . group ( 0 ) [ len ( look_for ) : ] else : return None
pull the version part out of a string .