util.py
Go to the documentation of this file.
1 import os
2 import os.path
3 import sys
4 import traceback
5 
6 from .package import Package
7 
8 
9 def get_packages(root_fn='.', create_objects=True):
10  packages = []
11  for root, dirs, files in sorted(os.walk(root_fn)):
12  if '.git' in root:
13  continue
14  if 'package.xml' in files:
15  if create_objects:
16  try:
17  packages.append(Package(root))
18  except Exception:
19  sys.stderr.write('ERROR: Trouble parsing package @ %s\n' % root)
20  sys.stderr.write(traceback.format_exc())
21  else:
22  packages.append(root)
23  return packages
24 
25 
26 def get_sibling_packages(package):
27  parent_path = os.path.abspath(os.path.join(package.root, '..'))
28 
29  sibling_packages = set()
30  for sub_package in get_packages(parent_path, create_objects=False):
31  pkg_name = os.path.split(sub_package)[1]
32  if pkg_name != package.name:
33  sibling_packages.add(pkg_name)
34  return sibling_packages
def get_sibling_packages(package)
Definition: util.py:26
def get_packages(root_fn='.', create_objects=True)
Definition: util.py:9


ros_introspection
Author(s):
autogenerated on Wed Mar 3 2021 03:56:00