/usr/lib/python2.7/dist-packages/rosdep2/catkin_packages.py is in python-rosdep 0.11.4-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | from __future__ import print_function
import os
import sys
try:
from catkin_pkg.packages import find_packages
except ImportError:
print("catkin_pkg was not detected, please install it.",
file=sys.stderr)
sys.exit(1)
_catkin_workspace_packages = []
_catkin_packages_cache = {}
def find_catkin_packages_in(path, verbose=False):
"""
:returns: a list of packages in a given directory
:raises: OSError if the path doesn't exist
"""
global _catkin_packages_cache
if not os.path.exists(path):
raise OSError("given path '{0}' does not exist".format(path))
if verbose:
print("Looking for packages in '{0}'... ".format(path),
end='', file=sys.stderr)
path = os.path.abspath(path)
if path in _catkin_packages_cache:
if verbose:
print("found in cache.", file=sys.stderr)
return _catkin_packages_cache[path]
packages = find_packages(path)
if type(packages) == dict and packages != {}:
package_names = [package.name for package in packages.values()]
if verbose:
print("found " + str(len(packages)) + " packages.")
for package in package_names:
print(" {0}".format(package))
_catkin_packages_cache[path] = package_names
return package_names
else:
if verbose:
print("failed to find packages.", file=sys.stderr)
return []
def set_workspace_packages(packages):
global _catkin_workspace_packages
_catkin_workspace_packages = list(packages or [])
def get_workspace_packages():
global _catkin_workspace_packages
return _catkin_workspace_packages
|