How to use the rosdep.core.RosdepException function in rosdep

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 / main.py View on Github external
return 0

        elif command == "check":
            return_val = 0
            missing_packages = r.check()
            if len(rejected_packages) > 0:
                print("Arguments %s are not packages"%rejected_packages, file=sys.stderr)
                return_val = 1
            if len(missing_packages) == 0:
                print("All required rosdeps are installed")
                return 0
            else:
                print("The following rosdeps were not installed", missing_packages)
                return 1

    except core.RosdepException as e:
        print(str(e), file=sys.stderr)
        return 1
github ros / ros / tools / rosdep / src / rosdep / installers.py View on Github external
if "ROSDEP_DEBUG" in os.environ:
            print "Fetching %s"%self.tarball
        f = urllib.urlretrieve(self.tarball)
        filename = f[0]
        if self.tarball_md5sum:
            hash1 = get_file_hash(filename)
            if self.tarball_md5sum != hash1:
                #try backup tarball if it is defined
                if self.alternate_tarball:
                    f = urllib.urlretrieve(self.alternate_tarball)
                    filename = f[0]
                    hash2 = get_file_hash(filename)
                    if self.tarball_md5sum != hash2:
                        raise rosdep.core.RosdepException("md5sum check on %s and %s failed.  Expected %s got %s and %s"%(self.tarball, self.alternate_tarball, self.tarball_md5sum, hash1, hash2))
                else:
                    raise rosdep.core.RosdepException("md5sum check on %s failed.  Expected %s got %s "%(self.tarball, self.tarball_md5sum, hash1))
            
        else:
            if "ROSDEP_DEBUG" in os.environ:
                print "No md5sum defined for tarball, not checking."
            
        try:
            tarf = tarfile.open(filename)
            tarf.extractall(tempdir)

            if execute:
                if "ROSDEP_DEBUG" in os.environ:
                    print "Running installation script"
                success = rosdep.core.create_tempfile_from_string_and_execute(self.install_command, os.path.join(tempdir, self.exec_path))
            elif display:
                print "Would have executed\n{{{%s\n}}}"%self.install_command
github ros / ros / tools / rosdep / src / rosdep / installers.py View on Github external
def fetch_file(url, md5sum=None):
    contents = ''
    try:
        fh= urllib2.urlopen(url)
        contents = fh.read()
        filehash =  hashlib.md5(contents).hexdigest()
        if md5sum and filehash != md5sum:
            raise rosdep.core.RosdepException( "md5sum didn't match for %s.  Expected %s got %s"%(url, md5sum, filehash))
    except urllib2.URLError as ex:
        raise rosdep.core.RosdepException(str(ex))

    return contents
github ros / ros / tools / rosdep / src / rosdep / installers.py View on Github external
def fetch_file(url, md5sum=None):
    contents = ''
    try:
        fh= urllib2.urlopen(url)
        contents = fh.read()
        filehash =  hashlib.md5(contents).hexdigest()
        if md5sum and filehash != md5sum:
            raise rosdep.core.RosdepException( "md5sum didn't match for %s.  Expected %s got %s"%(url, md5sum, filehash))
    except urllib2.URLError as ex:
        raise rosdep.core.RosdepException(str(ex))

    return contents
github ros / ros / tools / rosdep / src / rosdep / installers.py View on Github external
def __init__(self, arg_dict):
        self.url = arg_dict.get("uri")
        if not self.url:
            raise rosdep.core.RosdepException("uri required for source rosdeps") 
        self.alt_url = arg_dict.get("alternate-uri")
        self.md5sum = arg_dict.get("md5sum")

        self.manifest = None

        #TODO add md5sum verification
        if "ROSDEP_DEBUG" in os.environ:
            print "Downloading manifest %s"%self.url

        error = ''

        contents = ''
        # fetch the manifest
        try:
            contents = fetch_file(self.url, self.md5sum)
        except rosdep.core.RosdepException as ex: