manifest.py
Go to the documentation of this file.
1 from ros_introspection.package_xml import DEPEND_ORDERING
2 
3 from .util import REPLACE_PACKAGES
4 
5 
6 def set_build_type(manifest, build_type):
7  ex_el = manifest.get_export_tag()
8  build_type_node = ex_el.getElementsByTagName('build_type')
9  if build_type_node:
10  pass
11  else:
12  built_type_tag = manifest.tree.createElement('build_type')
13  built_type_tag.appendChild(manifest.tree.createTextNode(build_type))
14  manifest.insert_new_tag_inside_another(ex_el, built_type_tag)
15 
16  if build_type != 'ament_cmake':
17  return
18 
19  for build_tool in manifest.root.getElementsByTagName('buildtool_depend'):
20  name = build_tool.childNodes[0].nodeValue
21  if name == 'catkin':
22  build_tool.childNodes[0] = manifest.tree.createTextNode(build_type)
23 
24 
25 def update_manifest(package):
26  manifest = package.manifest
27  if manifest.format < 2:
28  manifest.upgrade(2)
29 
30  # Remove metapackage tag
31  pairs = []
32  for export_tag in manifest.tree.getElementsByTagName('export'):
33  for child in export_tag.childNodes:
34  if child.nodeType == child.ELEMENT_NODE and child.nodeName == 'metapackage':
35  pairs.append((export_tag, child))
36  for parent, child in pairs:
37  parent.removeChild(child)
38  manifest.changed = True
39 
40  # Replace some packages
41  for old_and_busted, new_hotness in REPLACE_PACKAGES.items():
42  for tag_name in DEPEND_ORDERING:
43  pkgs = package.manifest.get_packages_by_tag(tag_name)
44  if old_and_busted in pkgs:
45  package.manifest.remove_dependencies(tag_name, [old_and_busted])
46  if new_hotness not in pkgs:
47  package.manifest.insert_new_packages(tag_name, [new_hotness])
def set_build_type(manifest, build_type)
Definition: manifest.py:6


magical_ros2_conversion_tool
Author(s):
autogenerated on Wed Mar 3 2021 03:56:02