parameters: (exe_filename)
return_statement: return prefixes
docstring: Get exe->egg path translations for a given .exe file
docstring_summary: Get exe->egg path translations for a given .exe file
docstring_tokens: Get exe - > egg path translations for a given . exe file
function: def get_exe_prefixes(exe_filename):
      """Get exe->egg path translations for a given .exe file"""
  
      prefixes = [
          ('PURELIB/', ''),
          ('PLATLIB/pywin32_system32', ''),
          ('PLATLIB/', ''),
          ('SCRIPTS/', 'EGG-INFO/scripts/'),
          ('DATA/lib/site-packages', ''),
      ]
      z = zipfile.ZipFile(exe_filename)
      try:
          for info in z.infolist():
              name = info.filename
              parts = name.split('/')
              if len(parts) == 3 and parts[2] == 'PKG-INFO':
                  if parts[1].endswith('.egg-info'):
                      prefixes.insert(0, ('/'.join(parts[:2]), 'EGG-INFO/'))
                      break
              if len(parts) != 2 or not name.endswith('.pth'):
                  continue
              if name.endswith('-nspkg.pth'):
                  continue
              if parts[0].upper() in ('PURELIB', 'PLATLIB'):
                  contents = z.read(name)
                  if not six.PY2:
                      contents = contents.decode()
                  for pth in yield_lines(contents):
                      pth = pth.strip().replace('\\', '/')
                      if not pth.startswith('import'):
                          prefixes.append((('%s/%s/' % (parts[0], pth)), ''))
      finally:
          z.close()
      prefixes = [(x.lower(), y) for x, y in prefixes]
      prefixes.sort()
      prefixes.reverse()
      return prefixes
function_tokens: def get_exe_prefixes ( exe_filename ) : prefixes = [ ( 'PURELIB/' , '' ) , ( 'PLATLIB/pywin32_system32' , '' ) , ( 'PLATLIB/' , '' ) , ( 'SCRIPTS/' , 'EGG-INFO/scripts/' ) , ( 'DATA/lib/site-packages' , '' ) , ] z = zipfile . ZipFile ( exe_filename ) try : for info in z . infolist ( ) : name = info . filename parts = name . split ( '/' ) if len ( parts ) == 3 and parts [ 2 ] == 'PKG-INFO' : if parts [ 1 ] . endswith ( '.egg-info' ) : prefixes . insert ( 0 , ( '/' . join ( parts [ : 2 ] ) , 'EGG-INFO/' ) ) break if len ( parts ) != 2 or not name . endswith ( '.pth' ) : continue if name . endswith ( '-nspkg.pth' ) : continue if parts [ 0 ] . upper ( ) in ( 'PURELIB' , 'PLATLIB' ) : contents = z . read ( name ) if not six . PY2 : contents = contents . decode ( ) for pth in yield_lines ( contents ) : pth = pth . strip ( ) . replace ( '\\' , '/' ) if not pth . startswith ( 'import' ) : prefixes . append ( ( ( '%s/%s/' % ( parts [ 0 ] , pth ) ) , '' ) ) finally : z . close ( ) prefixes = [ ( x . lower ( ) , y ) for x , y in prefixes ] prefixes . sort ( ) prefixes . reverse ( ) return prefixes