How to use rosdep - 10 common examples

To help you get started, we’ve selected a few rosdep examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ros / ros / tools / rosdep / src / rosdep / arch.py View on Github external
# POSSIBILITY OF SUCH DAMAGE.

# Author Tully Foote/tfoote@willowgarage.com

from __future__ import with_statement
from linux_helpers import *
import os

import rosdep.base_rosdep

###### Arch SPECIALIZATION #########################

def pacman_detect(p):
    return subprocess.call(['pacman', '-Q', p], stdout=subprocess.PIPE, stderr=subprocess.PIPE)    

class Arch(rosdep.base_rosdep.RosdepBaseOS):

    def check_presence(self):
        filename = "/etc/arch-release"
        if os.path.exists(filename):
            return True
        return False

    def get_version(self):
        return ""
        # arch didn't have a version parsing in cpp version
        try:
            filename = "/etc/issue"
            if os.path.exists(filename):
                with open(filename, 'r') as fh:
                    os_list = fh.read().split()
                if os_list[0] == "Linux" and os_list[1] == "Arch":
github ros / ros / tools / rosdep / src / rosdep / debian.py View on Github external
import roslib.os_detect
import os 
import shutil
import urllib
import tarfile
import tempfile
import yaml

import rosdep.base_rosdep
import rosdep.core
import rosdep.installers

###### DEBIAN SPECIALIZATION #########################

###### Rosdep Test OS #########################
class RosdepTestOS(rosdep.base_rosdep.RosdepBaseOS):
    def __init__(self):
        self.name = "uninitialized"
        self.installers = {}

    def check_presence(self):
        if "ROSDEP_TEST_OS" in os.environ:
            return True
        return False

    def get_name(self):
        return os.environ.get("ROSDEP_TEST_OS", "rosdep_test_os")

    def get_version(self):
        return os.environ.get("ROSDEP_TEST_VERSION", "rosdep_test_version")
    
    def strip_detected_packages(self, packages):
github ros / ros / tools / rosdep / src / rosdep / debian.py View on Github external
def strip_detected_packages(self, packages):
        return packages

    def generate_package_install_command(self, packages, default_yes):
        if default_yes:
            return "#yes"
        else:
            return "#no"





###### Debian SPECIALIZATION #########################
class Debian(roslib.os_detect.Debian, rosdep.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
    how to check for and install packages."""
    def __init__(self):
        self.installers = {}
        self.installers['apt'] = rosdep.installers.AptInstaller
        self.installers['pip'] = rosdep.installers.PipInstaller
        self.installers['source'] = rosdep.installers.SourceInstaller
        self.installers['default'] = rosdep.installers.AptInstaller

    
    pass
###### END Debian SPECIALIZATION ########################

###### UBUNTU SPECIALIZATION #########################
github ros / ros / tools / rosdep / src / rosdep / redhat.py View on Github external
def strip_detected_packages(self, packages):
        return [p for p in packages if self.rpm_detect(p)]

    def generate_package_install_command(self, packages, default_yes):
        if not packages:
            return "#No Packages to install"

        if default_yes:
            return "#Packages\nsudo yum -y install " + ' '.join(packages)
        else:
            return "#Packages\nsudo yum install " + ' '.join(packages)


###### Fedora SPECIALIZATION #########################
class Fedora(roslib.os_detect.Fedora, YumInstall, rosdep.base_rosdep.RosdepBaseOS): 
    """This class provides the Rosdep OS API for by combining the Fedora
    OSDetect API and the YumInstall API
    """
    pass
                 
###### END Fedora SPECIALIZATION ########################

###### Rhel SPECIALIZATION #########################
class Rhel(roslib.os_detect.Rhel, YumInstall, rosdep.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
    """
    pass
###### END Rhel SPECIALIZATION ########################
github ros / ros / tools / rosdep / src / rosdep / gentoo.py View on Github external
return (std_out.count("") == 1)

# Check equery for existence and compatibility (gentoolkit 0.3)
def equery_available():
    if not os.path.exists("/usr/bin/equery"):
        return False

    cmd = ['equery', '-V']
    pop = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    (stdout, stderr) = pop.communicate()

    return "0.3." == stdout[8:12]


###### Gentoo SPECIALIZATION #########################
class Gentoo(roslib.os_detect.Gentoo, rosdep.base_rosdep.RosdepBaseOS):
    def strip_detected_packages(self, packages):
        if equery_available():
            return [p for p in packages if equery_detect(p)]
        else:
            return packages

    def generate_package_install_command(self, packages, default_yes):
        if equery_available():
            return "#Packages\nsudo emerge " + ' '.join(packages)
        else:
	    return "#Packages\nsudo emerge -u " + ' '.join(packages)
github ros / ros / tools / rosdep / src / rosdep / cygwin.py View on Github external
# Tingfan Wu tingfan@gmail.com

import os
import roslib.os_detect

import rosdep.base_rosdep

###### Cygwin SPECIALIZATION #########################
def port_detect(p):
    import subprocess
    cmd = ['cygcheck', '-c', p]
    pop = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    (std_out, std_err) = pop.communicate()
    return (std_out.count("OK") > 0)

class Cygwin(roslib.os_detect.Cygwin, rosdep.base_rosdep.RosdepBaseOS):
    def strip_detected_packages(self, packages):
        return [p for p in packages if not port_detect(p)] 

    def generate_package_install_command(self, packages, default_yes):        
        return "#Packages\napt-cyg -m ftp://sourceware.org/pub/cygwinports install " + ' '.join(packages)

###### END Cygwin SPECIALIZATION ########################

if __name__ == '__main__':
    print "cygwin installed?", Cygwin().check_presence()
    print "test port_detect(true)", port_detect('cygwin');
    print "version", Cygwin().get_version()
github ros / ros / tools / rosdep / src / rosdep / redhat.py View on Github external
return "#Packages\nsudo yum -y install " + ' '.join(packages)
        else:
            return "#Packages\nsudo yum install " + ' '.join(packages)


###### Fedora SPECIALIZATION #########################
class Fedora(roslib.os_detect.Fedora, YumInstall, rosdep.base_rosdep.RosdepBaseOS): 
    """This class provides the Rosdep OS API for by combining the Fedora
    OSDetect API and the YumInstall API
    """
    pass
                 
###### END Fedora SPECIALIZATION ########################

###### Rhel SPECIALIZATION #########################
class Rhel(roslib.os_detect.Rhel, YumInstall, rosdep.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
    """
    pass
###### END Rhel SPECIALIZATION ########################
github ros / ros / tools / rosdep / src / rosdep / core.py View on Github external
def __init__(self, packages, command = "rosdep", robust = False):
        os_list = [debian.RosdepTestOS(), debian.Debian(), debian.Ubuntu(), debian.Mint(), opensuse.OpenSuse(), redhat.Fedora(), redhat.Rhel(), arch.Arch(), osx.Osx(), gentoo.Gentoo(), cygwin.Cygwin(), freebsd.FreeBSD()]
        # Make sure that these classes are all well formed.  
        for o in os_list:
            if not isinstance(o, rosdep.base_rosdep.RosdepBaseOS):
                raise RosdepException("Class [%s] not derived from RosdepBaseOS"%o.__class__.__name__)
        # Detect the OS on which this program is running. 
        self.osi = roslib.os_detect.OSDetect(os_list)
        self.yc = YamlCache(self.osi.get_name(), self.osi.get_version(), self.osi.get_os().installers)
        self.packages = packages
        rp = roslib.packages.ROSPackages()
        self.rosdeps = rp.rosdeps(packages)
        self.robust = robust
github ros / ros / tools / rosdep / src / rosdep / macports.py View on Github external
# Author Tully Foote/tfoote@willowgarage.com

import os

import rosdep.base_rosdep
from rosdep.linux_helpers import *

###### Macports SPECIALIZATION #########################
def port_detect(p):
    cmd = ['port', 'installed', p]
    pop = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    (std_out, std_err) = pop.communicate()
    
    return (std_out.count("(active)") > 0)

class Macports(rosdep.base_rosdep.RosdepBaseOS):
    def check_presence(self):
        filename = "/usr/bin/sw_vers"
        if os.path.exists(filename):
            return True
        return False
    
    def get_version(self):
        return "macports" # macports is a rolling release and isn't versionsed

    def get_name(self):
        return "macports"

    def strip_detected_packages(self, packages):
        return [p for p in packages if not port_detect(p)] 

    def generate_package_install_command(self, packages, default_yes):
github ros / ros / tools / rosdep / src / rosdep / osx.py View on Github external
import os

import rosdep.base_rosdep
from rosdep.linux_helpers import *
import roslib.os_detect

###### Macports SPECIALIZATION #########################
def port_detect(p):
    cmd = ['port', 'installed', p]
    pop = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    (std_out, std_err) = pop.communicate()
    
    return (std_out.count("(active)") > 0)

class Osx(roslib.os_detect.Osx, rosdep.base_rosdep.RosdepBaseOS):
    def __init__(self):
        self.installers = {}
        self.installers['pip'] = rosdep.installers.PipInstaller
        self.installers['macports'] = rosdep.installers.MacportsInstaller
        self.installers['default'] = rosdep.installers.MacportsInstaller
        self.installers['source'] = rosdep.installers.SourceInstaller

    def strip_detected_packages(self, packages):
        return [p for p in packages if not port_detect(p)] 

    def generate_package_install_command(self, packages, default_yes):        
        if len(packages) < 1:
            return "#No packages to install"
        return "#Packages\nsudo port install " + ' '.join(packages)