1 Star 0 Fork 180

安博/oepkgs-management

forked from oepkgs/oepkgs-management 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
test.py 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
汪重阳 提交于 2023-08-24 09:09 . create branch 22.03 sp2
import yaml
import time
import subprocess
count = 0
with open("path", "r") as f_path:
for line in f_path:
count += 1
print(count, line.strip())
add_branch = {'name': 'openEuler-22.03-LTS-SP2', 'type': 'protected', 'create_from': 'openEuler-22.03-LTS'}
with open(line.strip(), "r") as f_yaml_in:
data = yaml.safe_load(f_yaml_in)
if "sig-info.yaml" in line.strip():
continue
branches = data["branches"]
branch_list = []
for branch in data["branches"]:
branch_list.append(branch["name"])
if "openEuler-22.03-LTS" not in branch_list:
continue
if "openEuler-22.03-LTS-SP2" in branch_list:
continue
print(branch_list)
data["branches"].append(add_branch)
with open(line.strip(), "w") as f_yaml_out:
yaml.safe_dump(data, f_yaml_out, sort_keys=False)
if count % 100 == 0:
# 执行外部命令
process = subprocess.Popen(['sh', 'create_pr.sh'], stdout=subprocess.PIPE, text=True,
cwd="/home/wcy/oepkgs-management")
# 逐行读取输出
for output in process.stdout:
print(output.strip())
print(f"已读取{count}, 暂停60分钟。。。")
time.sleep(3600)
print("读取完毕")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/anbo123/oepkgs-management.git
[email protected]:anbo123/oepkgs-management.git
anbo123
oepkgs-management
oepkgs-management
master

搜索帮助