Commit c3db41dd authored by Jochen Sprickerhof's avatar Jochen Sprickerhof

Imported Upstream version 0.11.2

parent c3a0d964
<package>
<description brief="A ROS system dependency manager">
This is a standalone version of the rosdep system
dependency tool. This package should NOT be added
to a ROS_PACKAGE_PATH. Instead, it is designed to be
installed as a system dependency via apt, pip, or the like.
</description>
<author>Tully Foote/tfoote@willowgarage.com, Ken Conley/kwc@willowgarage.com</author>
<license>BSD</license>
<review status="experimental" notes="" />
<export>
<rosdoc config="rosdoc.yaml"/>
</export>
</package>
......@@ -8,13 +8,13 @@ setup(
version=__version__,
packages=['rosdep2', 'rosdep2.platforms'],
package_dir={'': 'src'},
install_requires=['catkin_pkg', 'rospkg', 'rosdistro >= 0.4.0', 'PyYAML >= 3.1'],
install_requires=['catkin_pkg', 'rospkg >= 1.0.34', 'rosdistro >= 0.4.0', 'PyYAML >= 3.1'],
setup_requires=['nose >= 1.0'],
test_suite='nose.collector',
test_requires=['mock'],
scripts=['scripts/rosdep', 'scripts/rosdep-source'],
author="Tully Foote, Ken Conley",
author_email="foote@willowgarage.com, kwc@willowgarage.com",
author_email="tfoote@osrfoundation.org",
url="http://wiki.ros.org/rosdep",
download_url="http://download.ros.org/downloads/rosdep/",
keywords=['ROS'],
......
__version__ = '0.11.0'
__version__ = '0.11.2'
......@@ -314,7 +314,7 @@ class PackageManagerInstaller(Installer):
self.detect_fn = detect_fn
self.supports_depends = supports_depends
self.as_root = True
self.sudo_command = 'sudo'
self.sudo_command = 'sudo -H'
def elevate_priv(self, cmd):
"""
......
......@@ -28,7 +28,10 @@
# Author Tully Foote, Ken Conley
from rospkg.os_detect import OS_DEBIAN, OS_UBUNTU, OsDetect
from __future__ import print_function
import sys
from rospkg.os_detect import OS_DEBIAN, OS_LINARO, OS_UBUNTU, OsDetect
from .pip import PIP_INSTALLER
from .gem import GEM_INSTALLER
......@@ -44,6 +47,7 @@ def register_installers(context):
def register_platforms(context):
register_debian(context)
register_linaro(context)
register_ubuntu(context)
def register_debian(context):
......@@ -54,6 +58,13 @@ def register_debian(context):
context.set_default_os_installer_key(OS_DEBIAN, APT_INSTALLER)
context.set_os_version_type(OS_DEBIAN, OsDetect.get_codename)
def register_linaro(context):
# Linaro is an alias for Ubuntu. If linaro is detected and it's not set as an override force ubuntu.
(os_name, os_version) = context.get_os_name_and_version()
if os_name == OS_LINARO and not context.os_override:
print("rosdep detected OS: [%s] aliasing it to: [%s]" % (OS_LINARO, OS_UBUNTU), file=sys.stderr)
context.set_os_override(OS_UBUNTU, context.os_detect.get_codename())
def register_ubuntu(context):
context.add_os_installer_key(OS_UBUNTU, APT_INSTALLER)
context.add_os_installer_key(OS_UBUNTU, PIP_INSTALLER)
......
#!/usr/bin/env python
# Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved.
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
......@@ -13,7 +13,7 @@
# * Neither the name of the Willow Garage, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
......@@ -39,9 +39,11 @@ from ..shell_utils import read_stdout
# pip package manager key
PIP_INSTALLER = 'pip'
def register_installers(context):
context.set_installer(PIP_INSTALLER, PipInstaller())
def is_pip_installed():
try:
subprocess.Popen(['pip'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
......@@ -49,14 +51,17 @@ def is_pip_installed():
except OSError:
return False
def pip_detect(pkgs, exec_fn=None):
"""
"""
Given a list of package, return the list of installed packages.
:param exec_fn: function to execute Popen and read stdout (for testing)
"""
fallback_to_pip_show = False
if exec_fn is None:
exec_fn = read_stdout
fallback_to_pip_show = True
pkg_list = exec_fn(['pip', 'freeze']).split('\n')
ret_list = []
......@@ -64,10 +69,23 @@ def pip_detect(pkgs, exec_fn=None):
pkg_row = pkg.split("==")
if pkg_row[0] in pkgs:
ret_list.append(pkg_row[0])
# Try to detect with the return code of `pip show`.
# This can show the existance of things like `argparse` which
# otherwise do not show up.
# See:
# https://github.com/pypa/pip/issues/1570#issuecomment-71111030
if fallback_to_pip_show:
for pkg in [p for p in pkgs if p not in ret_list]:
if subprocess.call(['pip', 'show', '-q', pkg]) == 0:
# `pip show` detected it, add it to the list.
ret_list.append(pkg)
return ret_list
class PipInstaller(PackageManagerInstaller):
"""
"""
:class:`Installer` support for pip.
"""
......@@ -82,4 +100,3 @@ class PipInstaller(PackageManagerInstaller):
return []
else:
return [self.elevate_priv(['pip', 'install', '-U', p]) for p in packages]
[DEFAULT]
Depends: python-rospkg, python-yaml, python-catkin-pkg, python-rosdistro (>= 0.4.0)
Depends3: python3-rospkg, python3-yaml, python3-catkin-pkg, python3-rosdistro (>= 0.4.0)
Depends: python-rospkg (>= 1.0.34), python-yaml, python-catkin-pkg, python-rosdistro (>= 0.4.0)
Depends3: python3-rospkg (>= 1.0.34), python3-yaml, python3-catkin-pkg, python3-rosdistro (>= 0.4.0)
Conflicts: python3-rosdep
Conflicts3: python-rosdep
Suite: oneiric precise quantal raring saucy trusty utopic vivid wheezy jessie
X-Python3-Version: >= 3.2
......@@ -46,12 +46,12 @@ def test_PacmanInstaller():
# no interactive option implemented yet
mock_method.return_value = ['a', 'b']
expected = [['sudo', 'pacman', '-Sy', '--needed', 'a'],
['sudo', 'pacman', '-Sy', '--needed', 'b']]
expected = [['sudo', '-H', 'pacman', '-Sy', '--needed', 'a'],
['sudo', '-H', 'pacman', '-Sy', '--needed', 'b']]
val = installer.get_install_command(['whatever'], interactive=False)
assert val == expected, val
expected = [['sudo', 'pacman', '-Sy', '--needed', 'a'],
['sudo', 'pacman', '-Sy', '--needed', 'b']]
expected = [['sudo', '-H', 'pacman', '-Sy', '--needed', 'a'],
['sudo', '-H', 'pacman', '-Sy', '--needed', 'b']]
val = installer.get_install_command(['whatever'], interactive=True)
assert val == expected, val
try:
......
......@@ -66,13 +66,13 @@ def test_AptInstaller():
assert [] == installer.get_install_command(['fake'])
mock_method.return_value = ['a', 'b']
expected = [['sudo', 'apt-get', 'install', '-y', 'a'],
['sudo', 'apt-get', 'install', '-y', 'b']]
expected = [['sudo', '-H', 'apt-get', 'install', '-y', 'a'],
['sudo', '-H', 'apt-get', 'install', '-y', 'b']]
val = installer.get_install_command(['whatever'], interactive=False)
print("VAL", val)
assert val == expected, val
expected = [['sudo', 'apt-get', 'install', 'a'],
['sudo', 'apt-get', 'install', 'b']]
expected = [['sudo', '-H', 'apt-get', 'install', 'a'],
['sudo', '-H', 'apt-get', 'install', 'b']]
val = installer.get_install_command(['whatever'], interactive=True)
assert val == expected, val
try:
......
......@@ -90,12 +90,12 @@ def test_GemInstaller():
# no interactive option with GEM
mock_method.return_value = ['a', 'b']
expected = [['sudo', 'gem', 'install', 'a'],
['sudo', 'gem', 'install', 'b']]
expected = [['sudo', '-H', 'gem', 'install', 'a'],
['sudo', '-H', 'gem', 'install', 'b']]
val = installer.get_install_command(['whatever'], interactive=False)
assert val == expected, val
expected = [['sudo', 'gem', 'install', 'a'],
['sudo', 'gem', 'install', 'b']]
expected = [['sudo', '-H', 'gem', 'install', 'a'],
['sudo', '-H', 'gem', 'install', 'b']]
val = installer.get_install_command(['whatever'], interactive=True)
assert val == expected, val
try:
......
......@@ -176,13 +176,13 @@ def test_PortageInstaller():
mock_method.return_value = ['a', 'b']
expected = [['sudo', 'emerge', 'a'],
['sudo', 'emerge', 'b']]
expected = [['sudo', '-H', 'emerge', 'a'],
['sudo', '-H', 'emerge', 'b']]
val = installer.get_install_command(['whatever'], interactive=False)
assert val == expected, val
expected = [['sudo', 'emerge', '-a', 'a'],
['sudo', 'emerge', '-a', 'b']]
expected = [['sudo', '-H', 'emerge', '-a', 'a'],
['sudo', '-H', 'emerge', '-a', 'b']]
val = installer.get_install_command(['whatever'], interactive=True)
assert val == expected, val
......
......@@ -568,5 +568,5 @@ def test_RosdepInstaller_install_resolved():
stdout_lines = [x.strip() for x in stdout.getvalue().split('\n') if x.strip()]
assert len(stdout_lines) == 3
assert stdout_lines[0] == '#[apt] Installation commands:'
assert 'sudo apt-get install rosdep-fake1' in stdout_lines, 'stdout_lines: %s' % stdout_lines
assert 'sudo apt-get install rosdep-fake2' in stdout_lines, 'stdout_lines: %s' % stdout_lines
assert 'sudo -H apt-get install rosdep-fake1' in stdout_lines, 'stdout_lines: %s' % stdout_lines
assert 'sudo -H apt-get install rosdep-fake2' in stdout_lines, 'stdout_lines: %s' % stdout_lines
......@@ -46,10 +46,10 @@ def test_ZypperInstaller():
# no interactive option with YUM
mock_method.return_value = ['a', 'b']
expected = [['sudo', 'zypper', 'install', '-yl', 'a', 'b']]
expected = [['sudo', '-H', 'zypper', 'install', '-yl', 'a', 'b']]
val = installer.get_install_command(['whatever'], interactive=False)
assert val == expected, val
expected = [['sudo', 'zypper', 'install', 'a', 'b']]
expected = [['sudo', '-H', 'zypper', 'install', 'a', 'b']]
val = installer.get_install_command(['whatever'], interactive=True)
assert val == expected, val
try:
......
......@@ -88,12 +88,12 @@ def test_PipInstaller():
# no interactive option with PIP
mock_method.return_value = ['a', 'b']
expected = [['sudo', 'pip', 'install', '-U', 'a'],
['sudo', 'pip', 'install', '-U', 'b']]
expected = [['sudo', '-H', 'pip', 'install', '-U', 'a'],
['sudo', '-H', 'pip', 'install', '-U', 'b']]
val = installer.get_install_command(['whatever'], interactive=False)
assert val == expected, val
expected = [['sudo', 'pip', 'install', '-U', 'a'],
['sudo', 'pip', 'install', '-U', 'b']]
expected = [['sudo', '-H', 'pip', 'install', '-U', 'a'],
['sudo', '-H', 'pip', 'install', '-U', 'b']]
val = installer.get_install_command(['whatever'], interactive=True)
assert val == expected, val
try:
......
......@@ -87,16 +87,16 @@ def test_YumInstaller():
# no interactive option with YUM
mock_method.return_value = ['a', 'b']
expected = [['sudo', 'yum', '--assumeyes', '--quiet', '--skip-broken', 'install', 'a', 'b']]
expected = [['sudo', '-H', 'yum', '--assumeyes', '--quiet', '--skip-broken', 'install', 'a', 'b']]
val = installer.get_install_command(['whatever'], interactive=False, quiet=True)
assert val == expected, val + expected
expected = [['sudo', 'yum', '--quiet', '--skip-broken', 'install', 'a', 'b']]
expected = [['sudo', '-H', 'yum', '--quiet', '--skip-broken', 'install', 'a', 'b']]
val = installer.get_install_command(['whatever'], interactive=True, quiet=True)
assert val == expected, val + expected
expected = [['sudo', 'yum', '--assumeyes', '--skip-broken', 'install', 'a', 'b']]
expected = [['sudo', '-H', 'yum', '--assumeyes', '--skip-broken', 'install', 'a', 'b']]
val = installer.get_install_command(['whatever'], interactive=False, quiet=False)
assert val == expected, val + expected
expected = [['sudo', 'yum', '--skip-broken', 'install', 'a', 'b']]
expected = [['sudo', '-H', 'yum', '--skip-broken', 'install', 'a', 'b']]
val = installer.get_install_command(['whatever'], interactive=True, quiet=False)
assert val == expected, val + expected
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment