parameters: (executable=sys.executable, lib='', version='', chunksize=16384)
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=16384):
  
      """ 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.
  
      """
      V = _comparable_version
      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)
      with open(executable, 'rb') as f:
          binary = f.read(chunksize)
          pos = 0
          while pos < len(binary):
              if b'libc' in binary or b'GLIBC' in binary:
                  m = _libc_search.search(binary, pos)
              else:
                  m = None
              if not m or m.end() == len(binary):
                  chunk = f.read(chunksize)
                  if chunk:
                      binary = binary[max(pos, len(binary) - 1000):] + chunk
                      pos = 0
                      continue
                  if not m:
                      break
              libcinit, glibc, glibcversion, so, threads, soversion = [
                  s.decode('latin1') if s is not None else s
                  for s in m.groups()]
              if libcinit and not lib:
                  lib = 'libc'
              elif glibc:
                  if lib != 'glibc':
                      lib = 'glibc'
                      version = glibcversion
                  elif V(glibcversion) > V(version):
                      version = glibcversion
              elif so:
                  if lib != 'glibc':
                      lib = 'libc'
                      if soversion and (not version or V(soversion) > V(version)):
                          version = soversion
                      if threads and version[-len(threads):] != threads:
                          version = version + threads
              pos = m.end()
      return lib, version
function_tokens: def libc_ver ( executable = sys . executable , lib = '' , version = '' , chunksize = 16384 ) : V = _comparable_version 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 ) with open ( executable , 'rb' ) as f : binary = f . read ( chunksize ) pos = 0 while pos < len ( binary ) : if b'libc' in binary or b'GLIBC' in binary : m = _libc_search . search ( binary , pos ) else : m = None if not m or m . end ( ) == len ( binary ) : chunk = f . read ( chunksize ) if chunk : binary = binary [ max ( pos , len ( binary ) - 1000 ) : ] + chunk pos = 0 continue if not m : break libcinit , glibc , glibcversion , so , threads , soversion = [ s . decode ( 'latin1' ) if s is not None else s for s in m . groups ( ) ] if libcinit and not lib : lib = 'libc' elif glibc : if lib != 'glibc' : lib = 'glibc' version = glibcversion elif V ( glibcversion ) > V ( version ) : version = glibcversion elif so : if lib != 'glibc' : lib = 'libc' if soversion and ( not version or V ( soversion ) > V ( version ) ) : version = soversion if threads and version [ - len ( threads ) : ] != threads : version = version + threads pos = m . end ( ) return lib , version