Pull Request已成功合入, 合并人@CANN-robot
(感谢 IceT_5 的贡献)变更摘要
本次PR是对开源软件元数据工具(OSSinfo_extraction)的代码检视修复,不涉及功能变更。主要聚焦于代码质量改进:修复资源清理逻辑、集中管理常量、去除 LICENSE_EXTENSIONS 中的冗余大小写变体、移除未使用的导入,以及统一代码格式(尾部空格、末尾换行符)。
主要改动
-
extract.py资源清理逻辑加固:将subprocess.run调用包裹在try/finally块中,并将shutil.rmtree(custom_tmp)移入finally分支且添加ignore_errors=True,确保无论extractcode执行成功或失败,临时目录都会被清理。 -
config.py中LICENSE_EXTENSIONS去重:移除了.GPL、.APACHE、.MIT、.BSD、.LGPL、.MPL、.OFL、.CC0等大写扩展名变体,因为许可证文件名匹配已采用大小写不敏感方式,这些大写条目是冗余的。 -
prerequisite.py常量集中管理:将EXPECTED_SCANCODE_VERSION常量从prerequisite.py模块级定义移至config.py,并通过from .config import EXPECTED_SCANCODE_VERSION导入,实现版本号常量的统一管理。 -
main.pyCLI 参数检查简化:将if "--guide" in sys.argv or "-g" in sys.argv:改为仅检查"--guide",移除了-g短选项对指南功能的触发支持。 -
移除未使用的导入及格式统一:从
license_extraction.py和parse_and_duplication.py中移除未使用的import json;同时修复了license_extraction.py、main.py、parse_and_duplication.py、prerequisite.py、readme_opensource.py中多处尾部空格和末尾缺失换行符的问题,以及readme_opensource.py中多余的continue语句。


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/infrastructure | ✅ 宋常霞, 李超然 (2/2) | ✅ 宋常霞 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
IceT_5, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/lgtm
/approve


/lgtm


当前PR是否有AI参与:
[x] 否
[ ] 是
__1. AI Agent 平台:
__2. AI 模型:
__3. Prompt上下文 :
PR功能描述 / 为什么需要这个合入**:
该PR关联的issue
(格式为fixes #<issue号>, 或者resolves #<issue号>): fixes #
纯代码优化,无功能变化,无issue
希望检视人员了解:
改动类型 / Change Type
测试信息 / Testing
检查清单 / Checklist