6 from rosmsg
import list_types
8 DOT_ROS_FOLDER = os.path.expanduser(
'~/.ros')
9 PY_DEP_FILENAME = os.path.join(DOT_ROS_FOLDER,
'py_deps.yaml')
16 if os.path.exists(PY_DEP_FILENAME):
17 PYTHON_DEPS = yaml.load(open(PY_DEP_FILENAME))
18 if 'last_download' in PYTHON_DEPS:
19 now = datetime.datetime.now()
20 if now - PYTHON_DEPS[
'last_download'] < datetime.timedelta(days=3):
24 ff = requests.get(
'https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml').text
25 except requests.exceptions.ConnectionError:
26 print(
'Cannot retrieve latest python dependencies')
29 PYTHON_DEPS = yaml.load(ff)
30 PYTHON_DEPS[
'last_download'] = datetime.datetime.now()
32 if not os.path.exists(DOT_ROS_FOLDER):
33 os.mkdir(DOT_ROS_FOLDER)
34 yaml.dump(PYTHON_DEPS, open(PY_DEP_FILENAME,
'w'))
38 for var
in [key,
'python-' + key,
'python3-' + key, key.replace(
'python-',
'python3-'), key.replace(
'python-',
''),
39 key.replace(
'python-',
'').replace(
'-',
'_')]:
40 if var
in PYTHON_DEPS:
51 rospack = rospkg.RosPack()
52 for pkg
in rospack.list():
54 for mode, ros_set
in [(
'.msg', MESSAGES), (
'.srv', SERVICES)]:
55 for gen_key
in list_types(pkg, mode, rospack):
56 pkg, gen = gen_key.split(
'/')
57 ros_set.add((pkg, gen))
61 return pkg
in PACKAGES
65 return (pkg, msg)
in MESSAGES
69 return (pkg, srv)
in SERVICES
def get_python_dependency(key)
def maybe_download_python_deps()