Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rosdep help and logging for ROS 2. #921

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ dist
src/rosdep.egg-info
nose*
_build
install
log
8 changes: 4 additions & 4 deletions src/rosdep2/catkin_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ def find_catkin_packages_in(path, verbose=False):
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)
print("Looking for catkin packages in '{0}'... ".format(path),
end='')
path = os.path.abspath(path)
if path in _catkin_packages_cache:
if verbose:
print('found in cache.', file=sys.stderr)
print('found in cache.')
return _catkin_packages_cache[path]
packages = find_packages(path)
if type(packages) == dict and packages != {}:
Expand All @@ -43,7 +43,7 @@ def find_catkin_packages_in(path, verbose=False):
return package_names
else:
if verbose:
print('failed to find packages.', file=sys.stderr)
print('failed to find packages.')
return []


Expand Down
2 changes: 2 additions & 0 deletions src/rosdep2/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ def resolve_all(self, resources, installer_context, implicit=False):
for resource_name in resources:
try:
rosdep_keys = self.get_rosdeps(resource_name, implicit=implicit)
# Make key list unique
rosdep_keys = list(set(rosdep_keys))
if self.verbose:
print('resolve_all: resource [%s] requires rosdep keys [%s]' % (resource_name, ', '.join(rosdep_keys)), file=sys.stderr)
rosdep_keys = prune_catkin_packages(rosdep_keys, self.verbose)
Expand Down
35 changes: 26 additions & 9 deletions src/rosdep2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,34 @@ class UsageError(Exception):

Commands:

rosdep check <folders>... --from-paths
ROS 1 or 2 usage. Check for unmet dependencies of the catkin packages
located in the given <folders>.

rosdep check <stacks-and-packages>...
check if the dependencies of package(s) have been met.
ROS 1 usage. Check if the dependencies of package(s) have been met.
Searches workspace for manifest.xml and stack.xml files.

rosdep install <folders>... --from-paths
ROS 1 or 2 usage. Download and install the unmet dependencies of the catkin
packages located in the given <folders>.

rosdep install <stacks-and-packages>...
download and install the dependencies of a given package or packages.
ROS 1 usage. Download and install the dependencies of a given package
or packages.

rosdep db
generate the dependency database and print it to the console.

rosdep init
initialize rosdep sources in /etc/ros/rosdep. May require sudo.

rosdep keys <folders>... --from-paths
ROS 1 or 2 usage. List the dependencies of the catkin packages located in
the given <folders>.

rosdep keys <stacks-and-packages>...
list the rosdep keys that the packages depend on.
ROS 1 usage. List the rosdep keys that the packages depend on.

rosdep resolve <rosdeps>
resolve <rosdeps> to system dependencies
Expand Down Expand Up @@ -330,10 +344,10 @@ def _rosdep_main(args):
parser.add_option('--ignore-packages-from-source', '--ignore-src', '-i',
dest='ignore_src', default=False, action='store_true',
help="Affects the 'check', 'install', and 'keys' verbs. "
'If specified then rosdep will ignore keys that '
'are found to be catkin or ament packages anywhere in the '
'ROS_PACKAGE_PATH, AMENT_PREFIX_PATH or in any of the directories '
'given by the --from-paths option.')
'Causes rosdep to fulfill dependencies not only via installed '
'packages (as normal), but also via the workspace packages '
'(i.e., the catkin and ament packages located in the '
'ROS_PACKAGE_PATH or AMENT_PREFIX_PATH or --from-paths folders).')
parser.add_option('--skip-keys',
dest='skip_keys', action='append', default=[],
help="Affects the 'check' and 'install' verbs. The "
Expand Down Expand Up @@ -514,7 +528,7 @@ def _package_args_handler(command, parser, options, args):
# Handle the --ignore-src option
if command in ['install', 'check', 'keys'] and options.ignore_src:
if options.verbose:
print('Searching ROS_PACKAGE_PATH for '
print('--ignore-src: Searching ROS_PACKAGE_PATH for '
'sources: ' + str(os.environ['ROS_PACKAGE_PATH'].split(os.pathsep)))
ws_pkgs = get_workspace_packages()
for path in os.environ['ROS_PACKAGE_PATH'].split(os.pathsep):
Expand All @@ -530,10 +544,13 @@ def _package_args_handler(command, parser, options, args):
if AMENT_PREFIX_PATH_ENV_VAR in os.environ:
if options.verbose:
print(
'Searching ' + AMENT_PREFIX_PATH_ENV_VAR + ' for '
'--ignore-src: Searching ' + AMENT_PREFIX_PATH_ENV_VAR + ' for '
'sources: ' + str(os.environ[AMENT_PREFIX_PATH_ENV_VAR].split(':')))
ws_pkgs = get_workspace_packages()
pkgs = get_packages_with_prefixes().keys()
if options.verbose:
for package in pkgs:
print(' {0}'.format(package))
ws_pkgs.extend(pkgs)
# Make packages list unique
ws_pkgs = list(set(ws_pkgs))
Expand Down