def _search_variables(search_path, variable):
files = set()
cmd = "grep -rI '%s = ' %s" % (variable, quote(search_path))
try:
grep = subprocess32.check_output(cmd, shell=True)
except subprocess32.CalledProcessError:
return []
for line in grep.split('\n'):
if not line.strip():
continue
filename = line[:line.find(':')].strip()
if filename.startswith('.'):
continue
files.add(filename)
return files
评论列表
文章目录