misc.py
Go to the documentation of this file.
00001 import re
00002 import os
00003 from util import roscompile, make_executable
00004 from ros_introspection.util import get_packages
00005 
00006 MAINPAGE_S = "/\*\*\s+\\\\mainpage\s+\\\\htmlinclude manifest.html\s+\\\\b %s\s+<!--\s+" + \
00007              "Provide an overview of your package.\s+-->\s+-->\s+[^\*]*\*/"
00008 
00009 
00010 @roscompile
00011 def check_dynamic_reconfigure(package):
00012     cfgs = package.dynamic_reconfigs
00013     if len(cfgs) == 0:
00014         return
00015     pkg_list = set(['dynamic_reconfigure'])
00016     package.manifest.add_packages(pkg_list, pkg_list)
00017     package.cmake.section_check(cfgs, 'generate_dynamic_reconfigure_options', '')
00018     package.cmake.section_check(pkg_list, 'find_package', 'COMPONENTS')
00019 
00020     for fn in cfgs:
00021         make_executable(os.path.join(package.root, fn))
00022 
00023 
00024 @roscompile
00025 def remove_useless_files(package):
00026     mainpage_pattern = re.compile(MAINPAGE_S % package.name)
00027     for fn in package.misc_files:
00028         if 'mainpage.dox' in fn:
00029             full_path = os.path.join(package.root, fn)
00030             s = open(full_path).read()
00031             if mainpage_pattern.match(s):
00032                 os.remove(full_path)
00033 
00034 
00035 @roscompile
00036 def update_metapackage(package, require_matching_name=False):
00037     # TODO: Check if metapackage is in CMake
00038     # TODO: Ensure export is in there too
00039     if not package.manifest.is_metapackage():
00040         return False
00041 
00042     parent_path = os.path.abspath(os.path.join(package.root, '..'))
00043 
00044     if require_matching_name and os.path.split(parent_path)[1] != package.name:
00045         return False
00046 
00047     sub_packages = set()
00048     for sub_package in get_packages(parent_path, create_objects=False):
00049         pkg_name = os.path.split(sub_package)[1]
00050         if pkg_name != package.name:
00051             sub_packages.add(pkg_name)
00052     existing_sub_packages = package.manifest.get_packages('run')
00053     package.manifest.add_packages(set(), sub_packages, prefer_depend_tag=False)
00054 
00055     if package.manifest.format == 1:
00056         pkg_type = 'run_depend'
00057     else:
00058         pkg_type = 'exec_depend'
00059 
00060     package.manifest.remove_dependencies(pkg_type, existing_sub_packages - sub_packages)
00061     package.cmake.section_check([], 'catkin_metapackage', zero_okay=True)
00062 
00063 
00064 @roscompile
00065 def misc_xml_formatting(package):
00066     package.manifest.changed = True
00067     for config in package.plugin_configs:
00068         config.changed = True


roscompile
Author(s):
autogenerated on Wed Jun 19 2019 19:21:36