7 Star 1 Fork 7

BigSkySea / mkbshare

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
get_requires.py 781 Bytes
一键复制 编辑 原始数据 按行查看 历史
BigSkySea 提交于 2021-03-02 11:14 . add
import os
import re
import sys
specs_dir=sys.argv[1]
print(specs_dir)
requires_dict = {}
for root, dirs, files in os.walk(specs_dir):
print(len(files))
print("+++++")
for f in files:
name = f.split(".spec")[0]
with open(os.path.join(root, f)) as f:
text_str=f.read()
str_find = '.*Requires: (.*)'
tmp = re.findall(str_find, text_str)
requires_dict[name] = []
for t in tmp:
if "," in t:
requires_dict[name] = requires_dict[name] + list(set(t.split(",")) - set(['']))
else:
requires_dict[name] = requires_dict[name] + list(set(t.split(" ")) - set(['']))
print(requires_dict)
break
1
https://gitee.com/BigSkySea/mkbshare.git
git@gitee.com:BigSkySea/mkbshare.git
BigSkySea
mkbshare
mkbshare
master

搜索帮助