reducing sub-module interdependence for easier refactoring
This commit is contained in:
parent
54b38fbce2
commit
116e7fa247
|
@ -70,8 +70,8 @@ def set_verbose(v):
|
|||
global VERBOSE
|
||||
VERBOSE = v
|
||||
|
||||
EXT = roslib.names.MSG_EXT #alias
|
||||
SEP = roslib.names.PRN_SEPARATOR #e.g. std_msgs/String
|
||||
EXT = '.msg'
|
||||
SEP = '/' #e.g. std_msgs/String
|
||||
## character that designates a constant assignment rather than a field
|
||||
CONSTCHAR = '='
|
||||
COMMENTCHAR = '#'
|
||||
|
@ -378,7 +378,7 @@ def _init():
|
|||
if std_msgs_dir is None:
|
||||
raise MsgSpecException("Unable to locate roslib: %s files cannot be loaded"%EXT)
|
||||
|
||||
header = os.path.join(std_msgs_dir, roslib.packages.MSG_DIR, fname)
|
||||
header = os.path.join(std_msgs_dir, 'msg', fname)
|
||||
if not os.path.isfile(header):
|
||||
sys.stderr.write("ERROR: cannot locate %s. Expected to find it at '%s'\n"%(fname, header))
|
||||
return False
|
||||
|
@ -412,7 +412,7 @@ def list_msg_types(package, include_depends):
|
|||
@param include_depends bool: if True, will also list messages in package dependencies
|
||||
@return [str]: message type names
|
||||
"""
|
||||
types = roslib.resources.list_package_resources(package, include_depends, roslib.packages.MSG_DIR, _msg_filter)
|
||||
types = roslib.resources.list_package_resources(package, include_depends, 'msg', _msg_filter)
|
||||
return [x[:-len(EXT)] for x in types]
|
||||
|
||||
def msg_file(package, type_):
|
||||
|
@ -427,7 +427,7 @@ def msg_file(package, type_):
|
|||
@return: file path of .msg file in specified package
|
||||
@rtype: str
|
||||
"""
|
||||
return roslib.packages.resource_file(package, roslib.packages.MSG_DIR, type_+EXT)
|
||||
return roslib.packages.resource_file(package, 'msg', type_+EXT)
|
||||
|
||||
def get_pkg_msg_specs(package):
|
||||
"""
|
||||
|
|
|
@ -39,10 +39,6 @@ Library for manipulating ROS Names. See U{http://ros.org/wiki/Names}.
|
|||
import os
|
||||
import sys
|
||||
|
||||
#TODO: why are these here?
|
||||
MSG_EXT = '.msg'
|
||||
SRV_EXT = '.srv'
|
||||
|
||||
#TODO: deprecate PRN_SEPARATOR
|
||||
PRN_SEPARATOR = '/'
|
||||
TYPE_SEPARATOR = PRN_SEPARATOR #alias
|
||||
|
|
|
@ -36,7 +36,6 @@ The APIs of this library are still very coupled with the rosdep
|
|||
command-line tool.
|
||||
"""
|
||||
|
||||
import roslib.exceptions
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
@ -117,7 +116,7 @@ class OSOverride:
|
|||
return self._os_name
|
||||
|
||||
|
||||
class OSDetectException(roslib.exceptions.ROSLibException): pass
|
||||
class OSDetectException(Exception): pass
|
||||
|
||||
class OSBase:
|
||||
"""
|
||||
|
|
|
@ -54,8 +54,6 @@ import roslib.names
|
|||
import roslib.rosenv
|
||||
import roslib.os_detect
|
||||
|
||||
MSG_DIR = 'msg'
|
||||
SRV_DIR = 'srv'
|
||||
SRC_DIR = 'src'
|
||||
|
||||
# aliases
|
||||
|
|
|
@ -46,7 +46,6 @@ try:
|
|||
except ImportError:
|
||||
from io import StringIO # Python 3.x
|
||||
|
||||
import roslib.exceptions
|
||||
import roslib.msgs
|
||||
import roslib.names
|
||||
import roslib.packages
|
||||
|
@ -57,8 +56,8 @@ import roslib.resources
|
|||
import roslib.manifest
|
||||
|
||||
## file extension
|
||||
EXT = roslib.names.SRV_EXT #alias
|
||||
SEP = roslib.names.PRN_SEPARATOR #e.g. std_msgs/String
|
||||
EXT = '.srv' #alias
|
||||
SEP = '/' #e.g. std_msgs/String
|
||||
## input/output deliminator
|
||||
IODELIM = '---'
|
||||
COMMENTCHAR = roslib.msgs.COMMENTCHAR
|
||||
|
@ -73,7 +72,7 @@ def set_verbose(v):
|
|||
global VERBOSE
|
||||
VERBOSE = v
|
||||
|
||||
class SrvSpecException(roslib.exceptions.ROSLibException): pass
|
||||
class SrvSpecException(Exception): pass
|
||||
|
||||
# msg spec representation ##########################################
|
||||
|
||||
|
@ -123,7 +122,7 @@ def list_srv_types(package, include_depends):
|
|||
@return: service type names
|
||||
@rtype: [str]
|
||||
"""
|
||||
types = roslib.resources.list_package_resources(package, include_depends, roslib.packages.SRV_DIR, _srv_filter)
|
||||
types = roslib.resources.list_package_resources(package, include_depends, 'srv', _srv_filter)
|
||||
return [x[:-len(EXT)] for x in types]
|
||||
|
||||
def srv_file(package, type_):
|
||||
|
@ -135,7 +134,7 @@ def srv_file(package, type_):
|
|||
@return: file path of .srv file in specified package
|
||||
@rtype: str
|
||||
"""
|
||||
return roslib.packages.resource_file(package, roslib.packages.SRV_DIR, type_+EXT)
|
||||
return roslib.packages.resource_file(package, 'srv', type_+EXT)
|
||||
|
||||
def get_pkg_srv_specs(package):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue