parameters: (wininfo_name, egginfo_name)
return_statement: return {'name': w_name, 'ver': w_ver, 'arch': w_arch, 'pyver': w_pyver}
docstring: Extract metadata from filenames.
  
      Extracts the 4 metadataitems needed (name, version, pyversion, arch) from
      the installer filename and the name of the egg-info directory embedded in
      the zipfile (if any).
  
      The egginfo filename has the format::
  
          name-ver(-pyver)(-arch).egg-info
  
      The installer filename has the format::
  
          name-ver.arch(-pyver).exe
  
      Some things to note:
  
      1. The installer filename is not definitive. An installer can be renamed
         and work perfectly well as an installer. So more reliable data should
         be used whenever possible.
      2. The egg-info data should be preferred for the name and version, because
         these come straight from the distutils metadata, and are mandatory.
      3. The pyver from the egg-info data should be ignored, as it is
         constructed from the version of Python used to build the installer,
         which is irrelevant - the installer filename is correct here (even to
         the point that when it's not there, any version is implied).
      4. The architecture must be taken from the installer filename, as it is
         not included in the egg-info data.
      5. Architecture-neutral installers still have an architecture because the
         installer format itself (being executable) is architecture-specific. We
         should therefore ignore the architecture if the content is pure-python.
docstring_summary: Extract metadata from filenames.
docstring_tokens: Extract metadata from filenames .
function: def parse_wininst_info(wininfo_name, egginfo_name):
      """Extract metadata from filenames.
  
      Extracts the 4 metadataitems needed (name, version, pyversion, arch) from
      the installer filename and the name of the egg-info directory embedded in
      the zipfile (if any).
  
      The egginfo filename has the format::
  
          name-ver(-pyver)(-arch).egg-info
  
      The installer filename has the format::
  
          name-ver.arch(-pyver).exe
  
      Some things to note:
  
      1. The installer filename is not definitive. An installer can be renamed
         and work perfectly well as an installer. So more reliable data should
         be used whenever possible.
      2. The egg-info data should be preferred for the name and version, because
         these come straight from the distutils metadata, and are mandatory.
      3. The pyver from the egg-info data should be ignored, as it is
         constructed from the version of Python used to build the installer,
         which is irrelevant - the installer filename is correct here (even to
         the point that when it's not there, any version is implied).
      4. The architecture must be taken from the installer filename, as it is
         not included in the egg-info data.
      5. Architecture-neutral installers still have an architecture because the
         installer format itself (being executable) is architecture-specific. We
         should therefore ignore the architecture if the content is pure-python.
      """
  
      egginfo = None
      if egginfo_name:
          egginfo = egg_info_re.search(egginfo_name)
          if not egginfo:
              raise ValueError("Egg info filename %s is not valid" % (egginfo_name,))
  
      # Parse the wininst filename
      # 1. Distribution name (up to the first '-')
      w_name, sep, rest = wininfo_name.partition('-')
      if not sep:
          raise ValueError("Installer filename %s is not valid" % (wininfo_name,))
  
      # Strip '.exe'
      rest = rest[:-4]
      # 2. Python version (from the last '-', must start with 'py')
      rest2, sep, w_pyver = rest.rpartition('-')
      if sep and w_pyver.startswith('py'):
          rest = rest2
          w_pyver = w_pyver.replace('.', '')
      else:
          # Not version specific - use py2.py3. While it is possible that
          # pure-Python code is not compatible with both Python 2 and 3, there
          # is no way of knowing from the wininst format, so we assume the best
          # here (the user can always manually rename the wheel to be more
          # restrictive if needed).
          w_pyver = 'py2.py3'
      # 3. Version and architecture
      w_ver, sep, w_arch = rest.rpartition('.')
      if not sep:
          raise ValueError("Installer filename %s is not valid" % (wininfo_name,))
  
      if egginfo:
          w_name = egginfo.group('name')
          w_ver = egginfo.group('ver')
  
      return {'name': w_name, 'ver': w_ver, 'arch': w_arch, 'pyver': w_pyver}
function_tokens: def parse_wininst_info ( wininfo_name , egginfo_name ) : egginfo = None if egginfo_name : egginfo = egg_info_re . search ( egginfo_name ) if not egginfo : raise ValueError ( "Egg info filename %s is not valid" % ( egginfo_name , ) ) # Parse the wininst filename # 1. Distribution name (up to the first '-') w_name , sep , rest = wininfo_name . partition ( '-' ) if not sep : raise ValueError ( "Installer filename %s is not valid" % ( wininfo_name , ) ) # Strip '.exe' rest = rest [ : - 4 ] # 2. Python version (from the last '-', must start with 'py') rest2 , sep , w_pyver = rest . rpartition ( '-' ) if sep and w_pyver . startswith ( 'py' ) : rest = rest2 w_pyver = w_pyver . replace ( '.' , '' ) else : # Not version specific - use py2.py3. While it is possible that # pure-Python code is not compatible with both Python 2 and 3, there # is no way of knowing from the wininst format, so we assume the best # here (the user can always manually rename the wheel to be more # restrictive if needed). w_pyver = 'py2.py3' # 3. Version and architecture w_ver , sep , w_arch = rest . rpartition ( '.' ) if not sep : raise ValueError ( "Installer filename %s is not valid" % ( wininfo_name , ) ) if egginfo : w_name = egginfo . group ( 'name' ) w_ver = egginfo . group ( 'ver' ) return { 'name' : w_name , 'ver' : w_ver , 'arch' : w_arch , 'pyver' : w_pyver }