def _locate_repo_files(repo, rewrite=False):
 ret_val = []
 files = []
 conf_dirs = ['/etc/xbps.d/', '/usr/share/xbps.d/']
 name_glob = '*.conf'
 regex = re.compile((('\\s*repository\\s*=\\s*' + repo) + '/?\\s*(#.*)?$'))
 for cur_dir in conf_dirs:
  files.extend(glob.glob((cur_dir + name_glob)))
 for filename in files:
  write_buff = []
  with salt.utils.fopen(filename, 'r') as cur_file:
   for line in cur_file:
    if regex.match(line):
     ret_val.append(filename)
    else:
     write_buff.append(line)
  if (rewrite and (filename in ret_val)):
   if (len(write_buff) > 0):
    with salt.utils.fopen(filename, 'w') as rewrite_file:
     rewrite_file.write(''.join(write_buff))
   else:
    os.remove(filename)
 return ret_val

def _locate_repo_files ( repo , rewrite = False ) : ret_val = [ ] files = [ ] conf_dirs = [ '/etc/xbps.d/' , '/usr/share/xbps.d/' ] name_glob = '*.conf' regex = re . compile ( ( ( '\\s*repository\\s*=\\s*' + repo ) + '/?\\s*(#.*)?$' ) ) for cur_dir in conf_dirs : files . extend ( glob . glob ( ( cur_dir + name_glob ) ) ) for filename in files : write_buff = [ ] with salt . utils . fopen ( filename , 'r' ) as cur_file : for line in cur_file : if regex . match ( line ) : ret_val . append ( filename ) else : write_buff . append ( line ) if ( rewrite and ( filename in ret_val ) ) : if ( len ( write_buff ) > 0 ) : with salt . utils . fopen ( filename , 'w' ) as rewrite_file : rewrite_file . write ( '' . join ( write_buff ) ) else : os . remove ( filename ) return ret_val
find what file a repo is called in .