adding standard base class into rosdep for #2358

This commit is contained in:
Tully Foote 2010-02-12 02:12:20 +00:00
parent 54b96a030c
commit 5473c499be
7 changed files with 62 additions and 11 deletions

View File

@ -31,13 +31,15 @@
from __future__ import with_statement
from linux_helpers import *
import os
import base_rosdep
###### Arch SPECIALIZATION #########################
def pacman_detect(p):
return subprocess.call(['pacman', '-Q', p], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
class Arch:
class Arch(base_rosdep.RosdepBaseOS):
def check_presence(self):
filename = "/etc/arch-release"

View File

@ -0,0 +1,45 @@
#!/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
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * 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
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# Author Tully Foote/tfoote@willowgarage.com
import subprocess
import os.path
import roslib.os_detect
###### DEBIAN SPECIALIZATION #########################
###### Rosdep Test OS #########################
class RosdepBaseOS(roslib.os_detect.OSBase):
def strip_detected_packages(self, packages):
raise OSDetectException("strip_detected_packages unimplemented")
def generate_package_install_command(self, packages, default_yes):
raise OSDetectException("generate_package_install_command unimplemented")

View File

@ -30,6 +30,7 @@
import os
import roslib.os_detect
import base_rosdep
###### Cygwin SPECIALIZATION #########################
def port_detect(p):
@ -39,7 +40,7 @@ def port_detect(p):
(std_out, std_err) = pop.communicate()
return (std_out.count("OK") > 0)
class Cygwin(roslib.os_detect.Cygwin):
class Cygwin(roslib.os_detect.Cygwin, base_rosdep.RosdepBaseOS):
def strip_detected_packages(self, packages):
return [p for p in packages if not port_detect(p)]

View File

@ -31,11 +31,12 @@
import subprocess
import os.path
import roslib.os_detect
import base_rosdep
###### DEBIAN SPECIALIZATION #########################
###### Rosdep Test OS #########################
class RosdepTestOS(roslib.os_detect.OSBase):
class RosdepTestOS(base_rosdep.RosdepBaseOS):
def __init__(self):
self.name = "uninitialized"
def check_presence(self):
@ -87,7 +88,7 @@ class AptGetInstall():
return "#Packages\nsudo apt-get install " + ' '.join(packages)
###### Debian SPECIALIZATION #########################
class Debian(roslib.os_detect.Debian, AptGetInstall):
class Debian(roslib.os_detect.Debian, AptGetInstall, base_rosdep.RosdepBaseOS):
""" This is an implementation of a standard interface for
interacting with rosdep. This defines all Ubuntu sepecific
methods, including detecting the OS/Version number. As well as
@ -96,7 +97,7 @@ class Debian(roslib.os_detect.Debian, AptGetInstall):
###### END Debian SPECIALIZATION ########################
###### UBUNTU SPECIALIZATION #########################
class Ubuntu(roslib.os_detect.Ubuntu, AptGetInstall):
class Ubuntu(roslib.os_detect.Ubuntu, AptGetInstall, base_rosdep.RosdepBaseOS):
""" This is an implementation of a standard interface for
interacting with rosdep. This defines all Ubuntu sepecific
methods, including detecting the OS/Version number. As well as
@ -106,7 +107,7 @@ class Ubuntu(roslib.os_detect.Ubuntu, AptGetInstall):
###### END UBUNTU SPECIALIZATION ########################
###### Mint SPECIALIZATION #########################
class Mint(AptGetInstall):
class Mint(AptGetInstall, base_rosdep.RosdepBaseOS):
""" This is an implementation of a standard interface for
interacting with rosdep. Mint is closely coupled to Ubuntu, it
will masquerade as ubuntu for the purposes of rosdep. """

View File

@ -30,6 +30,7 @@ from __future__ import with_statement
import os.path
import roslib.os_detect
import subprocess
import base_rosdep
# Determine whether package p needs to be installed
def equery_detect(p):
@ -52,7 +53,7 @@ def equery_available():
###### Gentoo SPECIALIZATION #########################
class Gentoo(roslib.os_detect.Gentoo):
class Gentoo(roslib.os_detect.Gentoo, base_rosdep.RosdepBaseOS):
def strip_detected_packages(self, packages):
if equery_available():
return [p for p in packages if equery_detect(p)]

View File

@ -30,7 +30,7 @@
from linux_helpers import *
import os
import base_rosdep
###### Macports SPECIALIZATION #########################
def port_detect(p):
cmd = ['port', 'installed', p]
@ -39,7 +39,7 @@ def port_detect(p):
return (std_out.count("(active)") > 0)
class Macports:
class Macports(base_rosdep.RosdepBaseOS):
def check_presence(self):
filename = "/usr/bin/sw_vers"
if os.path.exists(filename):

View File

@ -31,6 +31,7 @@
import os.path
import roslib.os_detect
import subprocess
import base_rosdep
class YumInstall:
"""This class provides the functions for installing using yum
@ -53,7 +54,7 @@ class YumInstall:
###### Fedora SPECIALIZATION #########################
class Fedora(roslib.os_detect.Fedora, YumInstall):
class Fedora(roslib.os_detect.Fedora, YumInstall, base_rosdep.RosdepBaseOS):
"""This class provides the Rosdep OS API for by combining the Fedora
OSDetect API and the YumInstall API
"""
@ -62,7 +63,7 @@ class Fedora(roslib.os_detect.Fedora, YumInstall):
###### END Fedora SPECIALIZATION ########################
###### Rhel SPECIALIZATION #########################
class Rhel(roslib.os_detect.Rhel, YumInstall):
class Rhel(roslib.os_detect.Rhel, YumInstall, base_rosdep.RosdepBaseOS):
"""This class provides the Red Hat Enterprise Linux Rosdep OS API
for by combining the RHEL OSDetect API and the YumInstall API
"""