parameters: (executable=sys.executable,lib='',version='',
  
               chunksize=2048)
return_statement: return lib,version
docstring: Tries to determine the libc version that the file executable
          (which defaults to the Python interpreter) is linked against.
  
          Returns a tuple of strings (lib,version) which default to the
          given parameters in case the lookup fails.
  
          Note that the function has intimate knowledge of how different
          libc versions add symbols to the executable and thus is probably
          only useable for executables compiled using gcc.
  
          The file is read and scanned in chunks of chunksize bytes.
docstring_summary: Tries to determine the libc version that the file executable
          (which defaults to the Python interpreter) is linked against.
docstring_tokens: Tries to determine the libc version that the file executable ( which defaults to the Python interpreter ) is linked against .
function: def libc_ver(executable=sys.executable,lib='',version='',
  
               chunksize=2048):
  
      """ Tries to determine the libc version that the file executable
          (which defaults to the Python interpreter) is linked against.
  
          Returns a tuple of strings (lib,version) which default to the
          given parameters in case the lookup fails.
  
          Note that the function has intimate knowledge of how different
          libc versions add symbols to the executable and thus is probably
          only useable for executables compiled using gcc.
  
          The file is read and scanned in chunks of chunksize bytes.
  
      """
      if hasattr(os.path, 'realpath'):
          # Python 2.2 introduced os.path.realpath(); it is used
          # here to work around problems with Cygwin not being
          # able to open symlinks for reading
          executable = os.path.realpath(executable)
      f = open(executable,'rb')
      binary = f.read(chunksize)
      pos = 0
      while 1:
          m = _libc_search.search(binary,pos)
          if not m:
              binary = f.read(chunksize)
              if not binary:
                  break
              pos = 0
              continue
          libcinit,glibc,glibcversion,so,threads,soversion = m.groups()
          if libcinit and not lib:
              lib = 'libc'
          elif glibc:
              if lib != 'glibc':
                  lib = 'glibc'
                  version = glibcversion
              elif glibcversion > version:
                  version = glibcversion
          elif so:
              if lib != 'glibc':
                  lib = 'libc'
                  if soversion > version:
                      version = soversion
                  if threads and version[-len(threads):] != threads:
                      version = version + threads
          pos = m.end()
      f.close()
      return lib,version
function_tokens: def libc_ver ( executable = sys . executable , lib = '' , version = '' , chunksize = 2048 ) : if hasattr ( os . path , 'realpath' ) : # Python 2.2 introduced os.path.realpath(); it is used # here to work around problems with Cygwin not being # able to open symlinks for reading executable = os . path . realpath ( executable ) f = open ( executable , 'rb' ) binary = f . read ( chunksize ) pos = 0 while 1 : m = _libc_search . search ( binary , pos ) if not m : binary = f . read ( chunksize ) if not binary : break pos = 0 continue libcinit , glibc , glibcversion , so , threads , soversion = m . groups ( ) if libcinit and not lib : lib = 'libc' elif glibc : if lib != 'glibc' : lib = 'glibc' version = glibcversion elif glibcversion > version : version = glibcversion elif so : if lib != 'glibc' : lib = 'libc' if soversion > version : version = soversion if threads and version [ - len ( threads ) : ] != threads : version = version + threads pos = m . end ( ) f . close ( ) return lib , version