undoing r12833

This commit is contained in:
Ken Conley 2011-01-13 23:04:24 +00:00
parent 0860b7e368
commit ad4db86c55
10 changed files with 66 additions and 59 deletions

View File

@ -16,4 +16,4 @@ set(ROSPACK_MAKEDIST true)
# variables. # variables.
#list(APPEND CPACK_SOURCE_IGNORE_FILES /core/experimental) #list(APPEND CPACK_SOURCE_IGNORE_FILES /core/experimental)
rosbuild_make_distribution(1.4.0) rosbuild_make_distribution(1.3.2)

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright (c) 2009, Willow Garage, Inc. # Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved. # All rights reserved.
# #
@ -27,8 +28,9 @@
# Author Tully Foote/tfoote@willowgarage.com # Author Tully Foote/tfoote@willowgarage.com
from __future__ import with_statement
from linux_helpers import *
import os import os
import subprocess
import rosdep.base_rosdep import rosdep.base_rosdep
@ -56,7 +58,7 @@ class Arch(rosdep.base_rosdep.RosdepBaseOS):
if os_list[0] == "Linux" and os_list[1] == "Arch": if os_list[0] == "Linux" and os_list[1] == "Arch":
return os_list[2] return os_list[2]
except: except:
print("Arch failed to get version") print "Arch failed to get version"
return False return False
return False return False

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright (c) 2009, Willow Garage, Inc. # Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved. # All rights reserved.
# #
@ -31,6 +32,8 @@ import subprocess
import os.path import os.path
import roslib.os_detect import roslib.os_detect
###### DEBIAN SPECIALIZATION #########################
###### Rosdep Test OS ######################### ###### Rosdep Test OS #########################
class RosdepBaseOS(roslib.os_detect.OSBase): class RosdepBaseOS(roslib.os_detect.OSBase):
""" """

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright (c) 2009, Willow Garage, Inc. # Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved. # All rights reserved.
# #
@ -27,11 +28,11 @@
# Author Tully Foote/tfoote@willowgarage.com # Author Tully Foote/tfoote@willowgarage.com
""" #"""
Library and command-line tool for calculating rosdeps. #Library and command-line tool for calculating rosdeps.
""" #"""
from __future__ import unicode_literals from __future__ import with_statement
import roslib.rospack import roslib.rospack
import roslib.stacks import roslib.stacks
@ -55,17 +56,10 @@ import rosdep.arch as arch
import rosdep.cygwin as cygwin import rosdep.cygwin as cygwin
import rosdep.freebsd as freebsd import rosdep.freebsd as freebsd
# Python 3.x: the from __future__ import unicode_literals makes this unicode
yaml.add_constructor(
'tag:yaml.org,2002:float',
yaml.constructor.Constructor.construct_yaml_str)
try: yaml.add_constructor(
#Python 2.x u'tag:yaml.org,2002:float',
unicode = str yaml.constructor.Constructor.construct_yaml_str)
except NameError:
#Python 3.x
pass
class YamlCache: class YamlCache:
def __init__(self, os_name, os_version): def __init__(self, os_name, os_version):
@ -89,8 +83,8 @@ class YamlCache:
self._yaml_cache[path] = yaml.load(yaml_text) self._yaml_cache[path] = yaml.load(yaml_text)
return self._yaml_cache[path] return self._yaml_cache[path]
except yaml.YAMLError as exc: except yaml.YAMLError, exc:
sys.stderr.write("Failed parsing yaml while processing %s: %s\n"%(path, exc)) print >> sys.stderr, "Failed parsing yaml while processing %s\n"%path, exc
#sys.exit(1) # not a breaking error #sys.exit(1) # not a breaking error
self._yaml_cache[path] = {} self._yaml_cache[path] = {}
return {} return {}
@ -133,10 +127,10 @@ class YamlCache:
""" """
@return The os (and version specific if required) local package name @return The os (and version specific if required) local package name
""" """
if type(os_specific) in [str, unicode]: if type(os_specific) == type("String"):
return os_specific return os_specific
else:# it must be a map of versions else:# it must be a map of versions
if self.os_version in list(os_specific.keys()): if self.os_version in os_specific.keys():
return os_specific[self.os_version] return os_specific[self.os_version]
#print >> sys.stderr, "failed to find definition of %s for OS(%s) Version(%s) within '''%s'''. Defined in file %s"%(rosdep_name, self.os_name, self.os_version, os_specific, source_path) #print >> sys.stderr, "failed to find definition of %s for OS(%s) Version(%s) within '''%s'''. Defined in file %s"%(rosdep_name, self.os_name, self.os_version, os_specific, source_path)
return False return False
@ -181,9 +175,9 @@ class RosdepLookupPackage:
try: try:
rosdep_dependent_packages = ros_package_proxy.depends([package])[package] rosdep_dependent_packages = ros_package_proxy.depends([package])[package]
#print "package", package, "needs", rosdep_dependent_packages #print "package", package, "needs", rosdep_dependent_packages
except KeyError as ex: except KeyError, ex:
print("Depends Failed on package %s"%(ex)) print "Depends Failed on package", ex
print(" The errors was in %s"%(ros_package_proxy.depends([package]))) print " The errors was in ", ros_package_proxy.depends([package])
rosdep_dependent_packages = [] rosdep_dependent_packages = []
#print "Dependents of", package, rosdep_dependent_packages #print "Dependents of", package, rosdep_dependent_packages
rosdep_dependent_packages.append(package) rosdep_dependent_packages.append(package)
@ -194,24 +188,26 @@ class RosdepLookupPackage:
stack = None stack = None
try: try:
stack = roslib.stacks.stack_of(p) stack = roslib.stacks.stack_of(p)
except roslib.packages.InvalidROSPkgException as ex: except roslib.packages.InvalidROSPkgException, ex:
sys.stderr.write("Failed to find stack for package [%s]\n"%p) print >> sys.stderr, "Failed to find stack for package [%s]"%p
pass
if stack: if stack:
try: try:
paths.add( os.path.join(roslib.stacks.get_stack_dir(stack), "rosdep.yaml")) paths.add( os.path.join(roslib.stacks.get_stack_dir(stack), "rosdep.yaml"))
except AttributeError as ex: except AttributeError, ex:
print("Stack [%s] could not be found"%(stack)) print "Stack [%s] could not be found"%(stack)
for s in self.yaml_cache.get_rosstack_depends(stack): for s in self.yaml_cache.get_rosstack_depends(stack):
try: try:
paths.add( os.path.join(roslib.stacks.get_stack_dir(s), "rosdep.yaml")) paths.add( os.path.join(roslib.stacks.get_stack_dir(s), "rosdep.yaml"))
except AttributeError as ex: except AttributeError, ex:
print("Stack [%s] dependency of [%s] could not be found"%(s, stack)) print "Stack [%s] dependency of [%s] could not be found"%(s, stack)
else: else:
try: try:
paths.add( os.path.join(roslib.packages.get_pkg_dir(p), "rosdep.yaml")) paths.add( os.path.join(roslib.packages.get_pkg_dir(p), "rosdep.yaml"))
except roslib.packages.InvalidROSPkgException as ex: except roslib.packages.InvalidROSPkgException, ex:
sys.stderr.write("Failed to load rosdep.yaml for package [%s]:%s"%(p, ex)) print >> sys.stderr, "Failed to load rosdep.yaml for package [%s]:%s"%(p, ex)
pass
for path in paths: for path in paths:
self.insert_map(self.parse_yaml(path), path) self.insert_map(self.parse_yaml(path), path)
#print "built map", self.rosdep_map #print "built map", self.rosdep_map
@ -231,13 +227,14 @@ class RosdepLookupPackage:
if override: if override:
sys.stderr.write("ROSDEP_OVERRIDE: %s being overridden with %s from %s"%(key, yaml_dict[key], source_path)) print >>sys.stderr, "ROSDEP_OVERRIDE: %s being overridden with %s from %s"%(key, yaml_dict[key], source_path)
self.rosdep_source[key].append("Overriding with "+source_path) self.rosdep_source[key].append("Overriding with "+source_path)
self.rosdep_map[key] = rosdep_entry self.rosdep_map[key] = rosdep_entry
else: else:
if self.rosdep_map[key] == rosdep_entry: if self.rosdep_map[key] == rosdep_entry:
self.rosdep_source[key].append(source_path) self.rosdep_source[key].append(source_path)
#print >> sys.stderr, "DEBUG: Same key found for %s: %s"%(key, self.rosdep_map[key]) #print >> sys.stderr, "DEBUG: Same key found for %s: %s"%(key, self.rosdep_map[key])
pass
else: else:
cache_p = self.yaml_cache.get_os_from_yaml(key, yaml_dict[key], source_path) cache_p = self.yaml_cache.get_os_from_yaml(key, yaml_dict[key], source_path)
raise RosdepException("""QUITTING: due to conflicting rosdep definitions, please resolve this conflict. raise RosdepException("""QUITTING: due to conflicting rosdep definitions, please resolve this conflict.
@ -263,7 +260,7 @@ Rules for %s do not match:
if rosdep in self.rosdep_map: if rosdep in self.rosdep_map:
return self.rosdep_map[rosdep] return self.rosdep_map[rosdep]
else: else:
sys.stderr.write("Failed to find rosdep %s for package %s on OS:%s version:%s"%(rosdep, self.package, self.os_name, self.os_version)) print >> sys.stderr, "Failed to find rosdep %s for package %s on OS:%s version:%s"%(rosdep, self.package, self.os_name, self.os_version)
return False return False
def get_map(self): def get_map(self):
@ -312,7 +309,7 @@ class Rosdep:
yc = YamlCache(self.osi.get_name(), self.osi.get_version()) yc = YamlCache(self.osi.get_name(), self.osi.get_version())
start_time = time.time() start_time = time.time()
if "ROSDEP_DEBUG" in os.environ: if "ROSDEP_DEBUG" in os.environ:
print("Generating package list and scripts for %d rosdeps. This may take a few seconds..."%(len(self.packages))) print "Generating package list and scripts for %d rosdeps. This may take a few seconds..."%len(self.packages)
for p in self.packages: for p in self.packages:
rdlp = RosdepLookupPackage(self.osi.get_name(), self.osi.get_version(), p, yc) rdlp = RosdepLookupPackage(self.osi.get_name(), self.osi.get_version(), p, yc)
for r in self.rosdeps[p]: for r in self.rosdeps[p]:
@ -330,11 +327,11 @@ class Rosdep:
if not self.robust: if not self.robust:
raise RosdepException("ABORTING: Rosdeps %s could not be resolved"%failed_rosdeps) raise RosdepException("ABORTING: Rosdeps %s could not be resolved"%failed_rosdeps)
else: else:
sys.stderr.write("WARNING: Rosdeps %s could not be resolved"%failed_rosdeps) print >> sys.stderr, "WARNING: Rosdeps %s could not be resolved"%failed_rosdeps
time_delta = (time.time() - start_time) time_delta = (time.time() - start_time)
if "ROSDEP_DEBUG" in os.environ: if "ROSDEP_DEBUG" in os.environ:
print("Done loading rosdeps in %f seconds, averaging %f per rosdep."%(time_delta, time_delta/len(self.packages))) print "Done loading rosdeps in %f seconds, averaging %f per rosdep."%(time_delta, time_delta/len(self.packages))
return (list(set(native_packages)), list(set(scripts))) return (list(set(native_packages)), list(set(scripts)))
@ -353,8 +350,9 @@ class Rosdep:
scripts = [] scripts = []
try: try:
native_packages, scripts = self.get_packages_and_scripts() native_packages, scripts = self.get_packages_and_scripts()
except RosdepException as e: except RosdepException, e:
sys.stderr.write(str(e) + "\n") print >> sys.stderr, e
pass
undetected = self.osi.get_os().strip_detected_packages(native_packages) undetected = self.osi.get_os().strip_detected_packages(native_packages)
return_str = "" return_str = ""
return_str_scripts = "" return_str_scripts = ""
@ -382,7 +380,7 @@ class Rosdep:
fh.write(script) fh.write(script)
fh.flush() fh.flush()
print("rosdep executing this script:\n{{{\n%s\n}}}"%(script)) print "rosdep executing this script:\n{{{\n%s\n}}}"%script
p= subprocess.Popen(['bash', fh.name], stderr=subprocess.PIPE ) p= subprocess.Popen(['bash', fh.name], stderr=subprocess.PIPE )
(out, err) = p.communicate() (out, err) = p.communicate()
if p.returncode != 0: if p.returncode != 0:

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright (c) 2009, Willow Garage, Inc. # Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved. # All rights reserved.
# #
@ -28,20 +29,17 @@
# Tingfan Wu tingfan@gmail.com # Tingfan Wu tingfan@gmail.com
import os import os
import subprocess
import roslib.os_detect import roslib.os_detect
import rosdep.base_rosdep import rosdep.base_rosdep
###### Cygwin SPECIALIZATION ######################### ###### Cygwin SPECIALIZATION #########################
def port_detect(p): def port_detect(p):
try: import subprocess
cmd = ['cygcheck', '-c', p] cmd = ['cygcheck', '-c', p]
pop = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) pop = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(std_out, std_err) = pop.communicate() (std_out, std_err) = pop.communicate()
return (std_out.count("OK") > 0) return (std_out.count("OK") > 0)
except:
return False
class Cygwin(roslib.os_detect.Cygwin, rosdep.base_rosdep.RosdepBaseOS): class Cygwin(roslib.os_detect.Cygwin, rosdep.base_rosdep.RosdepBaseOS):
def strip_detected_packages(self, packages): def strip_detected_packages(self, packages):
@ -53,6 +51,6 @@ class Cygwin(roslib.os_detect.Cygwin, rosdep.base_rosdep.RosdepBaseOS):
###### END Cygwin SPECIALIZATION ######################## ###### END Cygwin SPECIALIZATION ########################
if __name__ == '__main__': if __name__ == '__main__':
print("cygwin installed? %s"%(Cygwin().check_presence())) print "cygwin installed?", Cygwin().check_presence()
print("test port_detect(true) %s"%(port_detect('cygwin'))) print "test port_detect(true)", port_detect('cygwin');
print("version %s"%(Cygwin().get_version())) print "version", Cygwin().get_version()

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright (c) 2009, Willow Garage, Inc. # Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved. # All rights reserved.
# #
@ -28,7 +29,7 @@
# Author Tully Foote/tfoote@willowgarage.com # Author Tully Foote/tfoote@willowgarage.com
import subprocess import subprocess
import os import os.path
import roslib.os_detect import roslib.os_detect
import rosdep.base_rosdep import rosdep.base_rosdep

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright (c) 2010, Willow Garage, Inc. # Copyright (c) 2010, Willow Garage, Inc.
# All rights reserved. # All rights reserved.
# #
@ -30,7 +31,7 @@
import os import os
import roslib.os_detect import roslib.os_detect
import rosdep.base_rosdep import base_rosdep
###### FreeBSD SPECIALIZATION ######################### ###### FreeBSD SPECIALIZATION #########################
def port_detect(p): def port_detect(p):
@ -53,7 +54,7 @@ def port_detect(p):
pop = subprocess.Popen("/usr/sbin/pkg_info -qE " + portname, shell=True) pop = subprocess.Popen("/usr/sbin/pkg_info -qE " + portname, shell=True)
return os.waitpid(pop.pid, 0)[1] == 0 # pkg_info -E returns 0 if pkg installed, 1 if not return os.waitpid(pop.pid, 0)[1] == 0 # pkg_info -E returns 0 if pkg installed, 1 if not
class FreeBSD(roslib.os_detect.FreeBSD, rosdep.base_rosdep.RosdepBaseOS): class FreeBSD(roslib.os_detect.FreeBSD, base_rosdep.RosdepBaseOS):
def strip_detected_packages(self, packages): def strip_detected_packages(self, packages):
return [p for p in packages if not port_detect(p)] return [p for p in packages if not port_detect(p)]
@ -62,7 +63,7 @@ class FreeBSD(roslib.os_detect.FreeBSD, rosdep.base_rosdep.RosdepBaseOS):
return "#No Packages to install" return "#No Packages to install"
if default_yes: if default_yes:
import sys import sys
sys.stderr.write("pkg_add does not have a default_yes option, continuing without\n") print >> sys.stderr, "pkg_add does not have a default_yes option, continuing without"
return "#Packages\nsudo /usr/sbin/pkg_add -r " + ' '.join(packages) return "#Packages\nsudo /usr/sbin/pkg_add -r " + ' '.join(packages)
###### END FreeBSD SPECIALIZATION ######################## ###### END FreeBSD SPECIALIZATION ########################

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright (c) 2009, Willow Garage, Inc. # Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved. # All rights reserved.
# #
@ -25,7 +26,8 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
import os from __future__ import with_statement
import os.path
import roslib.os_detect import roslib.os_detect
import subprocess import subprocess
@ -65,6 +67,6 @@ class Gentoo(roslib.os_detect.Gentoo, rosdep.base_rosdep.RosdepBaseOS):
elif equery_available(): elif equery_available():
return "#Packages\nsudo emerge " + ' '.join(packages) return "#Packages\nsudo emerge " + ' '.join(packages)
else: else:
return "#Packages\nsudo emerge -u " + ' '.join(packages) return "#Packages\nsudo emerge -u " + ' '.join(packages)
###### END Gentoo SPECIALIZATION ######################## ###### END Gentoo SPECIALIZATION ########################

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright (c) 2009, Willow Garage, Inc. # Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved. # All rights reserved.
# #
@ -28,9 +29,9 @@
# Author Tully Foote/tfoote@willowgarage.com # Author Tully Foote/tfoote@willowgarage.com
import os import os
import subprocess
import rosdep.base_rosdep import rosdep.base_rosdep
from rosdep.linux_helpers import *
###### Macports SPECIALIZATION ######################### ###### Macports SPECIALIZATION #########################
def port_detect(p): def port_detect(p):

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright (c) 2009, Willow Garage, Inc. # Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved. # All rights reserved.
# #
@ -27,7 +28,7 @@
# Author Tully Foote/tfoote@willowgarage.com # Author Tully Foote/tfoote@willowgarage.com
import os import os.path
import roslib.os_detect import roslib.os_detect
import subprocess import subprocess