1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 """
37 Wrappers for calling an processing return values from rospack and rosstack
38 """
39
40 import os
41 import sys
42 import subprocess
43 import roslib.exceptions
44 import roslib.rosenv
45
46 if sys.hexversion > 0x03000000:
47 python3 = True
48 else:
49 python3 = False
50
51 import threading
52
53 rospack_lock = threading.Lock()
54
56 """
57 @return: result of executing rospack command (via subprocess). string will be strip()ed.
58 @rtype: str
59 @raise roslib.exceptions.ROSLibException: if rospack command fails
60 """
61 rospack_bin = os.path.join(roslib.rosenv.get_ros_root(), 'bin', 'rospack')
62 with rospack_lock:
63 if python3:
64 val = subprocess.Popen([rospack_bin] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
65 val = val.decode().strip()
66 else:
67 val = (subprocess.Popen([rospack_bin] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0] or '').strip()
68 if val.startswith('rospack:'):
69 raise roslib.exceptions.ROSLibException(val)
70 return val
71
73 """
74 @param pkg: package name
75 @type pkg: str
76 @return: A list of the names of the packages which depend directly on pkg
77 @rtype: list
78 """
79 return rospackexec(['depends-on1', pkg]).split()
80
82 """
83 @param pkg: package name
84 @type pkg: str
85 @return: A list of the names of the packages which depend on pkg
86 @rtype: list
87 """
88 return rospackexec(['depends-on', pkg]).split()
89
91 """
92 @param pkg: package name
93 @type pkg: str
94 @return: A list of the names of the packages which pkg directly depends on
95 @rtype: list
96 """
97 return rospackexec(['deps1', pkg]).split()
98
100 """
101 @param pkg: package name
102 @type pkg: str
103 @return: A list of the names of the packages which pkg depends on
104 @rtype: list
105 """
106 return rospackexec(['deps', pkg]).split()
107
109 """
110 @param pkg: package name
111 @type pkg: str
112 @return: A list of the names of the packages which provide a plugin for pkg
113 @rtype: list
114 """
115 val = rospackexec(['plugins', '--attrib=plugin', pkg])
116 if val:
117 return [tuple(x.split(' ')) for x in val.split('\n')]
118 else:
119 return []
120
122 """
123 @return: result of executing rosstack command (via subprocess). string will be strip()ed.
124 @rtype: str
125 @raise roslib.exceptions.ROSLibException: if rosstack command fails
126 """
127 rosstack_bin = os.path.join(roslib.rosenv.get_ros_root(), 'bin', 'rosstack')
128 with rospack_lock:
129 if python3:
130 val = subprocess.Popen([rosstack_bin] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
131 val = val.decode().strip()
132 else:
133 val = (subprocess.Popen([rosstack_bin] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0] or '').strip()
134 if val.startswith('rosstack:'):
135 raise roslib.exceptions.ROSLibException(val)
136 return val
137
139 """
140 @param s: stack name
141 @type s: str
142 @return: A list of the names of the stacks which depend on s
143 @rtype: list
144 """
145 return rosstackexec(['depends-on', s]).split()
146
148 """
149 @param s: stack name
150 @type s: str
151 @return: A list of the names of the stacks which depend directly on s
152 @rtype: list
153 """
154 return rosstackexec(['depends-on1', s]).split()
155
157 """
158 @param s: stack name
159 @type s: str
160 @return: A list of the names of the stacks which s depends on
161 @rtype: list
162 """
163 return rosstackexec(['depends', s]).split()
164
166 """
167 @param s: stack name
168 @type s: str
169 @return: A list of the names of the stacks which s depends on directly
170 @rtype: list
171 """
172 return rosstackexec(['depends1', s]).split()
173