def module_name_from_dir(dirname, err=True, files=None):
 if (files is None):
  files = os.listdir(dirname)
 names = [file for file in files if (file.endswith('.so') or file.endswith('.pyd'))]
 if ((len(names) == 0) and (not err)):
  return None
 elif (len(names) == 1):
  return os.path.join(dirname, names[0])
 else:
  raise ValueError(('More than 1 compiled module in this directory:' + dirname))

def module_name_from_dir ( dirname , err = True , files = None ) : if ( files is None ) : files = os . listdir ( dirname ) names = [ file for file in files if ( file . endswith ( '.so' ) or file . endswith ( '.pyd' ) ) ] if ( ( len ( names ) == 0 ) and ( not err ) ) : return None elif ( len ( names ) == 1 ) : return os . path . join ( dirname , names [ 0 ] ) else : raise ValueError ( ( 'More than 1 compiled module in this directory:' + dirname ) )
scan the contents of a cache directory and return full path of the dynamic lib in it .