提交 e43e7be2 编写于 作者: S Shinwell Hu

remove global variable

上级 dc102a5c
......@@ -9,9 +9,8 @@ import sys
from os import path
import subprocess
nr = {}
def get_info(pkg):
nr = {}
proc = subprocess.Popen(["rpm", "-qpi", pkg], stdout=subprocess.PIPE)
while (True):
line = proc.stdout.readline()
......@@ -36,7 +35,7 @@ def get_info(pkg):
proc.stdout.close()
proc.wait()
return len(nr)
return nr
if __name__ == "__main__":
par = argparse.ArgumentParser()
......@@ -47,10 +46,11 @@ if __name__ == "__main__":
args = par.parse_args()
nr = {}
if (path.exists(args.pkg) and path.isfile(args.pkg)):
ret = get_info(args.pkg)
if (ret < 3):
print("Somthing is wrong\n")
nr = get_info(args.pkg)
if (len(nr) < 3):
print("Failed to parse the output of rpm -qpi {pkg}".format(pkg=args.pkg))
sys.exit(1)
else:
print("%s does not exist\n" & args.pkg)
......@@ -96,10 +96,10 @@ if __name__ == "__main__":
if valid_sig:
f = open(args.repo, "w")
yaml.dump(repo, f)
yaml.dump(repo, f, sort_keys=False)
f.close()
f = open(args.sigs, "w")
yaml.dump(sigs, f)
yaml.dump(sigs, f, sort_keys=False)
f.close()
else:
print("SIG name is not valid")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册