6 Star 3 Fork 12

openEuler/ros-porting-tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
get-package-xml.py 1.86 KB
一键复制 编辑 原始数据 按行查看 历史
NiuTao 提交于 2023-05-10 21:13 . fix: add run_depend to Requires
#!/usr/bin/python3
from xml.dom.minidom import parse
import xml.dom.minidom
import sys
PackageXMLTree = xml.dom.minidom.parse(sys.argv[2])
collection = PackageXMLTree.documentElement
def get_depend(depend_name, org_depend_file_name):
deps = collection.getElementsByTagName(depend_name)
f = open(org_depend_file_name, 'a+', encoding='utf-8')
for dep in deps:
if dep.hasAttribute("ROS_VERSION"):
ros_version = dep.getAttribute("ROS_VERSION")
if ros_version == "1":
continue
if dep.hasAttribute("condition"):
condition = dep.getAttribute("condition")
if condition == "$ROS_VERSION == 1":
continue
if condition == "$ROS_PYTHON_VERSION == 2":
continue
if dep.hasAttribute("type"):
url_type = dep.getAttribute("type")
if url_type != "website":
continue
if depend_name == "maintainer" and dep.hasAttribute("email"):
email = dep.getAttribute("email")
f.write(depend_name + ":" + dep.childNodes[0].data + " " + email + "\n")
f.close()
return
if depend_name == "description":
f.write(dep.childNodes[0].data + "\n")
else:
f.write(depend_name + ":" + dep.childNodes[0].data + "\n")
f.close()
get_depend("name", sys.argv[1])
get_depend("depend", sys.argv[1])
get_depend("build_depend", sys.argv[1])
get_depend("build_export_depend", sys.argv[1])
get_depend("exec_depend", sys.argv[1])
get_depend("test_depend", sys.argv[1])
get_depend("buildtool_depend", sys.argv[1])
get_depend("buildtool_export_depend", sys.argv[1])
get_depend("run_depend", sys.argv[1])
get_depend("license", sys.argv[1])
get_depend("url", sys.argv[1])
get_depend("maintainer", sys.argv[1])
get_depend("description", sys.argv[1] + "-description")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openeuler/ros-porting-tools.git
git@gitee.com:openeuler/ros-porting-tools.git
openeuler
ros-porting-tools
ros-porting-tools
master

搜索帮助