15 Star 89 Fork 47

hpmicro/hpm_sdk

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
check_excluded_targets.py 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
Ryan QIAN 提交于 2024-09-30 15:34 +08:00 . hpm sdk release v1.7.0
# Copyright (c) 2023-2024 HPMicro
# SPDX-License-Identifier: BSD-3-Clause
import re
import sys
import yaml
EXCLUDED_TARGETS="excluded_targets"
def unify_target_name(name):
unified_name = name
if re.match(r'^(debug|release)', name):
unified_name = "ram_" + name
elif not name.endswith("debug") and not name.endswith("release"):
unified_name = name + "_debug"
return unified_name
def get_excluded_targets(input_yml):
excluded = []
with open(input_yml, "r", encoding="utf-8", errors="ignore") as stream:
try:
info = yaml.safe_load(stream)
if not info is None and EXCLUDED_TARGETS in info.keys():
for t in info[EXCLUDED_TARGETS]:
excluded.append(unify_target_name(t.strip().lower()))
except yaml.YAMLError as e:
pass
stream.close()
if len(excluded):
sys.stdout.write("%s\n" % (";".join(excluded)))
return excluded
def check_excluded_targets(input_yml, build_type):
sys.stderr.write(build_type + "\n")
exc_tar = get_excluded_targets(input_yml)
if len(exc_tar) != 0:
build_type = unify_target_name(build_type)
if build_type in exc_tar:
sys.exit(1)
else:
sys.exit(0)
else:
sys.exit(0)
if __name__ == "__main__":
get_excluded_targets(sys.argv[1])
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hpmicro/hpm_sdk.git
git@gitee.com:hpmicro/hpm_sdk.git
hpmicro
hpm_sdk
hpm_sdk
main

搜索帮助