def find_bls(self, source_path, user_path): "Найдем все bls файлы, расчитаем md5 и найдем подключаемые ими модули" for root, dirs, filenames in os.walk(source_path): for filename in fnmatch.filter(filenames, '*.bls'): name = utils.file_name_by_basename(filename) full_path = os.path.join(root, filename) if self.files.get(name) != None: self.gen_multi_name_err(self.files[name].get_bls_path(), full_path) return False bll_path = os.path.join(user_path, name + '.bll') f = BlsObj(full_path, bll_path) f.update_bls() self.files[name] = f return True
def find_bls(self, cur_file_path, cur_file_text): "Вернет список всех bls файлов в проекте, которые экспортируют искомую функцию" path = PathResolver(cur_file_path).GetBlsDir() uses = utils.parse_bls(cur_file_text, 'uses') name = utils.file_name_by_fullname(cur_file_path) uses.append(name) bls_files = [] for root, dirs, filenames in os.walk(path): for filename in fnmatch.filter(filenames, '*.bls'): name = utils.file_name_by_basename(filename) if name in uses: full_path = os.path.join(root, filename) exports = utils.parse_bls(open(full_path).read(), 'exports') if self.func in exports: bls_files.append(full_path) return bls_files