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 Warning: do not use this library. It is unstable and most of the routines
38 here have been superceded by other libraries (e.g. rospkg). These
39 routines will likely be *deleted* in future releases.
40 """
41
42 import subprocess
43 import sys
44 import warnings
45
46 import roslib.exceptions
47
48 import rospkg
49
50 if sys.hexversion > 0x03000000:
51 python3 = True
52 else:
53 python3 = False
54
55
56 warnings.warn('roslib.rospack is deprecated, please use rospkg', stacklevel=2)
57
58
60 """
61 @return: result of executing rospack command (via subprocess). string will be strip()ed.
62 @rtype: str
63 @raise roslib.exceptions.ROSLibException: if rospack command fails
64 """
65 rospack_bin = 'rospack'
66 if python3:
67 val = subprocess.Popen([rospack_bin] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
68 val = val.decode().strip()
69 else:
70 val = (subprocess.Popen([rospack_bin] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0] or '').strip()
71 if val.startswith('rospack:'):
72 raise roslib.exceptions.ROSLibException(val)
73 return val
74
75
77 """
78 @param pkg: package name
79 @type pkg: str
80 @return: A list of the names of the packages which depend directly on pkg
81 @rtype: list
82 """
83 return rospackexec(['depends-on1', pkg]).split()
84
85
87 """
88 @param pkg: package name
89 @type pkg: str
90 @return: A list of the names of the packages which depend on pkg
91 @rtype: list
92 """
93 return rospackexec(['depends-on', pkg]).split()
94
95
97 """
98 @param pkg: package name
99 @type pkg: str
100 @return: A list of the names of the packages which pkg directly depends on
101 @rtype: list
102 """
103 return rospackexec(['deps1', pkg]).split()
104
105
107 """
108 @param pkg: package name
109 @type pkg: str
110 @return: A list of the names of the packages which pkg depends on
111 @rtype: list
112 """
113 return rospackexec(['deps', pkg]).split()
114
115
117 """
118 @param pkg: package name
119 @type pkg: str
120 @return: A list of the names of the packages which provide a plugin for pkg
121 @rtype: list
122 """
123 val = rospackexec(['plugins', '--attrib=plugin', pkg])
124 if val:
125 return [tuple(x.split(' ')) for x in val.split('\n')]
126 else:
127 return []
128
129
131 """
132 @return: result of executing rosstack command (via subprocess). string will be strip()ed.
133 @rtype: str
134 @raise roslib.exceptions.ROSLibException: if rosstack command fails
135 """
136 rosstack_bin = 'rosstack'
137 if python3:
138 val = subprocess.Popen([rosstack_bin] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
139 val = val.decode().strip()
140 else:
141 val = (subprocess.Popen([rosstack_bin] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0] or '').strip()
142 if val.startswith('rosstack:'):
143 raise roslib.exceptions.ROSLibException(val)
144 return val
145
146
148 """
149 @param s: stack name
150 @type s: str
151 @return: A list of the names of the stacks which depend on s
152 @rtype: list
153 """
154 return rosstackexec(['depends-on', s]).split()
155
156
158 """
159 @param s: stack name
160 @type s: str
161 @return: A list of the names of the stacks which depend directly on s
162 @rtype: list
163 """
164 return rosstackexec(['depends-on1', s]).split()
165
166
168 """
169 @param s: stack name
170 @type s: str
171 @return: A list of the names of the stacks which s depends on
172 @rtype: list
173 """
174 return rosstackexec(['depends', s]).split()
175
176
178 """
179 @param s: stack name
180 @type s: str
181 @return: A list of the names of the stacks which s depends on directly
182 @rtype: list
183 """
184 return rosstackexec(['depends1', s]).split()
185