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 os
43 import sys
44 import subprocess
45 import roslib.exceptions
46 import rospkg
47
48 if sys.hexversion > 0x03000000:
49 python3 = True
50 else:
51 python3 = False
52
53 import warnings
54 warnings.warn("roslib.rospack is deprecated, please use rospkg", stacklevel=2)
55
57 """
58 @return: result of executing rospack command (via subprocess). string will be strip()ed.
59 @rtype: str
60 @raise roslib.exceptions.ROSLibException: if rospack command fails
61 """
62 rospack_bin = 'rospack'
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 = 'rosstack'
128 if python3:
129 val = subprocess.Popen([rosstack_bin] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
130 val = val.decode().strip()
131 else:
132 val = (subprocess.Popen([rosstack_bin] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0] or '').strip()
133 if val.startswith('rosstack:'):
134 raise roslib.exceptions.ROSLibException(val)
135 return val
136
138 """
139 @param s: stack name
140 @type s: str
141 @return: A list of the names of the stacks which depend on s
142 @rtype: list
143 """
144 return rosstackexec(['depends-on', s]).split()
145
147 """
148 @param s: stack name
149 @type s: str
150 @return: A list of the names of the stacks which depend directly on s
151 @rtype: list
152 """
153 return rosstackexec(['depends-on1', s]).split()
154
156 """
157 @param s: stack name
158 @type s: str
159 @return: A list of the names of the stacks which s depends on
160 @rtype: list
161 """
162 return rosstackexec(['depends', s]).split()
163
165 """
166 @param s: stack name
167 @type s: str
168 @return: A list of the names of the stacks which s depends on directly
169 @rtype: list
170 """
171 return rosstackexec(['depends1', s]).split()
172