20 from __future__
import print_function
24 from queue
import Queue
25 from catkin.find_in_workspaces
import find_in_workspaces
26 from catkin_pkg.package
import parse_package
29 CATKIN_VIRTUALENV_TAGNAME =
"pip_requirements" 34 requirements_list = []
35 for export
in package.exports:
36 if export.tagname == CATKIN_VIRTUALENV_TAGNAME:
37 requirements_list.append(os.path.join(package_dir, export.content))
38 return requirements_list
44 package_path = find_in_workspaces(project=package_name, path=
"package.xml", first_match_only=
True,)[0]
47 raise RuntimeError(
"Unable to process package {}".format(package_name))
52 package = parse_package(package_path)
53 dependencies = package.build_depends + package.test_depends
59 """ Collect requirements inherited by a package. """ 60 package_queue = Queue()
61 package_queue.put(package_name)
62 processed_packages = set()
63 requirements_list = []
65 while not package_queue.empty():
66 queued_package = package_queue.get()
68 if queued_package
not in processed_packages:
69 processed_packages.add(queued_package)
71 package_name=queued_package, soft_fail=(queued_package != package_name)
73 requirements_list = requirements + requirements_list
76 for dependency
in dependencies:
77 package_queue.put(dependency.name)
79 return requirements_list
def collect_requirements(package_name, no_deps=False)
def parse_exported_requirements(package, package_dir)
def process_package(package_name, soft_fail=True)