def package_to_requirement(package_name):
 match = re.search('^(.*?)-(dev|\\d.*)', package_name)
 if match:
  name = match.group(1)
  version = match.group(2)
 else:
  name = package_name
  version = ''
 if version:
  return ('%s==%s' % (name, version))
 else:
  return name

def package_to_requirement ( package_name ) : match = re . search ( '^(.*?)-(dev|\\d.*)' , package_name ) if match : name = match . group ( 1 ) version = match . group ( 2 ) else : name = package_name version = '' if version : return ( '%s==%s' % ( name , version ) ) else : return name
translate a name like foo-1 .