forked from bhaskara/rosh_fuerte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuerte_update.patch
7949 lines (7905 loc) · 287 KB
/
fuerte_update.patch
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff -r cc8bd7a5eafb rosh/manifest.xml
--- a/rosh/manifest.xml Thu Mar 15 10:37:46 2012 -0700
+++ b/rosh/manifest.xml Tue Jun 12 15:24:41 2012 -0700
@@ -19,6 +19,7 @@
<depend package="rosservice"/>
<depend package="rosparam"/>
<depend package="rosmsg"/>
+ <depend package="roslib_electric"/>
<rosdep name="ipython" />
diff -r cc8bd7a5eafb rosh/src/rosh/__init__.py
--- a/rosh/src/rosh/__init__.py Thu Mar 15 10:37:46 2012 -0700
+++ b/rosh/src/rosh/__init__.py Tue Jun 12 15:24:41 2012 -0700
@@ -76,7 +76,7 @@
from rosh.impl.bag import Bag
from rosh.impl.service import Service
-from roslaunch.core import Node
+# from roslaunch.core import Node
def kill(obj):
if hasattr(obj, '_kill'):
diff -r cc8bd7a5eafb rosh/src/rosh/impl/launch.py
--- a/rosh/src/rosh/impl/launch.py Thu Mar 15 10:37:46 2012 -0700
+++ b/rosh/src/rosh/impl/launch.py Tue Jun 12 15:24:41 2012 -0700
@@ -42,7 +42,7 @@
import os
import sys
-import roslib.packages
+import roslib_electric.packages
import roslaunch
import rosh.impl.proc
diff -r cc8bd7a5eafb rosh/src/rosh/impl/msg.py
--- a/rosh/src/rosh/impl/msg.py Thu Mar 15 10:37:46 2012 -0700
+++ b/rosh/src/rosh/impl/msg.py Tue Jun 12 15:24:41 2012 -0700
@@ -36,7 +36,8 @@
import sys
-import roslib.packages
+import roslib_electric.packages
+import roslib_electric.srvs
import rospy
import rosmsg
@@ -87,7 +88,7 @@
elif key in self._msg_cache:
return self._msg_cache[key]
else:
- if self._config.mode == roslib.msgs.EXT:
+ if self._config.mode == roslib_electric.msgs.EXT:
v = self._type = get_message_class(self._ns + key)
else:
v = self._type = get_service_class(self._ns + key)
@@ -96,9 +97,9 @@
return v
def get_message_class(type_name):
- val = roslib.message.get_message_class(type_name, reload_on_error=True)
+ val = roslib_electric.message.get_message_class(type_name, reload_on_error=True)
if not val:
- pkg, base_type = roslib.names.package_resource_name(type_name)
+ pkg, base_type = roslib_electric.names.package_resource_name(type_name)
if '(' not in type_name:
# ipython has an introspection bug where it forwards the
# actual method call to the getattr.
@@ -110,9 +111,9 @@
return val
def get_service_class(type_name):
- val = roslib.message.get_service_class(type_name, reload_on_error=True)
+ val = roslib_electric.message.get_service_class(type_name, reload_on_error=True)
if not val:
- pkg, base_type = roslib.names.package_resource_name(type_name)
+ pkg, base_type = roslib_electric.names.package_resource_name(type_name)
if '(' not in type_name:
# ipython has an introspection bug where it forwards the
# actual method call to the getattr.
@@ -127,7 +128,7 @@
def __init__(self, ctx, lock):
super(Msgs, self).__init__(ctx, lock, MsgPackage)
- self._config.mode = roslib.msgs.EXT
+ self._config.mode = roslib_electric.msgs.EXT
def __contains__(self, key):
"""
@@ -146,7 +147,7 @@
def __init__(self, ctx, lock):
super(Srvs, self).__init__(ctx, lock, MsgPackage)
- self._config.mode = roslib.srvs.EXT
+ self._config.mode = roslib_electric.srvs.EXT
def __contains__(self, key):
"""
diff -r cc8bd7a5eafb rosh/src/rosh/impl/packages.py
--- a/rosh/src/rosh/impl/packages.py Thu Mar 15 10:37:46 2012 -0700
+++ b/rosh/src/rosh/impl/packages.py Tue Jun 12 15:24:41 2012 -0700
@@ -38,10 +38,10 @@
import stat
import sys
-import roslib.manifest
-import roslib.packages
-import roslib.stack_manifest
-import roslib.stacks
+import roslib_electric.manifest
+import roslib_electric.packages
+import roslib_electric.stack_manifest
+import roslib_electric.stacks
# TODO: get rid of Namespace and Concept entirely as that really doesn't apply here and just requires workarounds
from rosh.impl.namespace import Namespace, Concept, ResourceList
@@ -96,10 +96,10 @@
super(Package, self).__init__(name, config)
def _get_path(self):
- return roslib.packages.get_pkg_dir(self.name)
+ return roslib_electric.packages.get_pkg_dir(self.name)
def _get_manifest(self, path):
- return roslib.manifest.parse_file(os.path.join(path, roslib.manifest.MANIFEST_FILE))
+ return roslib_electric.manifest.parse_file(os.path.join(path, roslib_electric.manifest.MANIFEST_FILE))
def _get_msgs(self):
try:
@@ -208,7 +208,7 @@
# TODO: move into roslib for ROS 1.4. Right now rosh is targetting ROS 1.2 compatibility
def list_resources(pkg, filter_fn):
- return list_resources_by_dir(roslib.packages.get_pkg_dir(pkg), filter_fn)
+ return list_resources_by_dir(roslib_electric.packages.get_pkg_dir(pkg), filter_fn)
def list_resources_by_dir(pkg_dir, filter_fn):
resources = []
for p, dirs, files in os.walk(pkg_dir):
@@ -227,14 +227,14 @@
super(Stack, self).__init__(name, config)
def _get_path(self):
- return roslib.stacks.get_stack_dir(self.name)
+ return roslib_electric.stacks.get_stack_dir(self.name)
def _get_manifest(self, path):
- return roslib.stack_manifest.parse_file(os.path.join(path, roslib.stack_manifest.STACK_FILE))
+ return roslib_electric.stack_manifest.parse_file(os.path.join(path, roslib_electric.stack_manifest.STACK_FILE))
def _get_packages(self):
# we have to use the config from packages in order to get access to its cache
- return ResourceList(self._config.ctx.packages._config, roslib.stacks.packages_of(self.name), Package)
+ return ResourceList(self._config.ctx.packages._config, roslib_electric.stacks.packages_of(self.name), Package)
packages = property(_get_packages)
@@ -294,9 +294,9 @@
class Packages(ManifestResources):
def __init__(self, ctx, lock,):
- super(Packages, self).__init__(ctx, lock, Package, roslib.packages.list_pkgs)
+ super(Packages, self).__init__(ctx, lock, Package, roslib_electric.packages.list_pkgs)
class Stacks(ManifestResources):
def __init__(self, ctx, lock):
- super(Stacks, self).__init__(ctx, lock, Stack, roslib.stacks.list_stacks)
+ super(Stacks, self).__init__(ctx, lock, Stack, roslib_electric.stacks.list_stacks)
diff -r cc8bd7a5eafb rosh/src/rosh/impl/proc.py
--- a/rosh/src/rosh/impl/proc.py Thu Mar 15 10:37:46 2012 -0700
+++ b/rosh/src/rosh/impl/proc.py Tue Jun 12 15:24:41 2012 -0700
@@ -43,7 +43,8 @@
from subprocess import Popen, PIPE
import roslib.rosenv
-import roslaunch
+# import roslaunch
+
# TODO: get rid of this routine or replace with Exec
def run(config, cmd, stdout=True):
diff -r cc8bd7a5eafb rosh/src/rosh/impl/ros_graph.py
--- a/rosh/src/rosh/impl/ros_graph.py Thu Mar 15 10:37:46 2012 -0700
+++ b/rosh/src/rosh/impl/ros_graph.py Tue Jun 12 15:24:41 2012 -0700
@@ -35,7 +35,7 @@
import rosgraph.masterapi
import rosh.plugin
-from rosh.impl.launch import launch_symbols
+# from rosh.impl.launch import launch_symbols
from rosh.impl.namespace import Namespace
from rosh.impl.node import Nodes
from rosh.impl.param import Parameters
@@ -126,7 +126,7 @@
# Load topic tools
_loaded_symbols.update(topic_tools_symbols(ctx))
# Load roslaunch
- _loaded_symbols.update(launch_symbols(ctx))
+ # _loaded_symbols.update(launch_symbols(ctx))
# save these symbols in the context
ctx.msg = _loaded_symbols['msg']
diff -r cc8bd7a5eafb roshlaunch/src/roslaunch/core.py
--- a/roshlaunch/src/roslaunch/core.py Thu Mar 15 10:37:46 2012 -0700
+++ b/roshlaunch/src/roslaunch/core.py Tue Jun 12 15:24:41 2012 -0700
@@ -43,11 +43,11 @@
import roslib.names
import roslib.network
-import roslib.substitution_args
+import roslib_electric.substitution_args
import roslib.rosenv
#TODO:temporary until xacro is ported after next ROS stable release
-resolve_args = roslib.substitution_args.resolve_args
+resolve_args = roslib_electric.substitution_args.resolve_args
class RLException(Exception):
"""Base roslaunch exception type"""
diff -r cc8bd7a5eafb roshlaunch/src/roslaunch/xmlloader.py
--- a/roshlaunch/src/roslaunch/xmlloader.py Thu Mar 15 10:37:46 2012 -0700
+++ b/roshlaunch/src/roslaunch/xmlloader.py Tue Jun 12 15:24:41 2012 -0700
@@ -46,14 +46,14 @@
from xml.dom import Node as DomNode #avoid aliasing
from roslib.names import make_global_ns, ns_join, is_global, is_private, PRIV_NAME
-import roslib.substitution_args
+import roslib_electric.substitution_args
from roslaunch.core import Param, Node, Test, Machine, RLException, get_ros_package_path
import roslaunch.loader
# use in our namespace
-SubstitutionException = roslib.substitution_args.SubstitutionException
-ArgException = roslib.substitution_args.ArgException
+SubstitutionException = roslib_electric.substitution_args.SubstitutionException
+ArgException = roslib_electric.substitution_args.ArgException
NS='ns'
CLEAR_PARAMS='clear_params'
@@ -151,11 +151,11 @@
def resolve_args(self, args, context):
"""
- Wrapper around roslib.substitution_args.resolve_args to set common parameters
+ Wrapper around roslib_electric.substitution_args.resolve_args to set common parameters
"""
# resolve_args gets called a lot, so we optimize by testing for dollar sign before resolving
if args and '$' in args:
- return roslib.substitution_args.resolve_args(args, context=context.resolve_dict, resolve_anon=self.resolve_anon)
+ return roslib_electric.substitution_args.resolve_args(args, context=context.resolve_dict, resolve_anon=self.resolve_anon)
else:
return args
@@ -267,7 +267,7 @@
context.add_arg(name, value=value, default=default)
- except roslib.substitution_args.ArgException, e:
+ except roslib_electric.substitution_args.ArgException, e:
raise XmlParseException(
"arg '%s' is not defined. \n\nArg xml is %s"%(e, tag.toxml()))
except Exception, e:
diff -r cc8bd7a5eafb roslib_electric/CMakeLists.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roslib_electric/CMakeLists.txt Tue Jun 12 15:24:41 2012 -0700
@@ -0,0 +1,17 @@
+if(ROSBUILD)
+ # this is for rosbuild2 integration, you can ignore this
+ include(rosbuild.cmake OPTIONAL)
+ return()
+endif()
+cmake_minimum_required(VERSION 2.4.6)
+include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
+rosbuild_init()
+
+rosbuild_add_boost_directories()
+
+rosbuild_add_library(roslib src/package.cpp)
+rosbuild_link_boost(roslib thread)
+
+if (NOT APPLE)
+target_link_libraries(roslib rt)
+endif (NOT APPLE)
diff -r cc8bd7a5eafb roslib_electric/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roslib_electric/Makefile Tue Jun 12 15:24:41 2012 -0700
@@ -0,0 +1,1 @@
+include $(shell rospack find mk)/cmake.mk
diff -r cc8bd7a5eafb roslib_electric/epydoc.config
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roslib_electric/epydoc.config Tue Jun 12 15:24:41 2012 -0700
@@ -0,0 +1,9 @@
+[epydoc]
+name: roslib
+modules: roslib
+inheritance: included
+url: http://ros.org/wiki/rospy
+frames: yes
+private: no
+exclude: roslib.msg
+
diff -r cc8bd7a5eafb roslib_electric/mainpage.dox
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roslib_electric/mainpage.dox Tue Jun 12 15:24:41 2012 -0700
@@ -0,0 +1,18 @@
+/**
+\mainpage
+\htmlinclude manifest.html
+
+
+\b %roslib is the base library support for ROS <a href="http://ros.org/wiki/Client Libraries">client implementations</a> as well as ROS tools. It includes:
+
+- common message definitions used in ROS clients (e.g. Header)
+- a Python library for manipulating ROS system resources (e.g. .msg files, names)
+- message and services generation callout scripts
+
+\section codeapi Code API
+
+- Time-related: ros::Time, ros::Duration, ros::Rate, ros::WallTime, ros::WallDuration, ros::WallRate. Also see the <a href="http://ros.org/wiki/roscpp/Overview/Time">roscpp Time overview</a>.
+- Package-related: ros::package namespace
+- Debug-related: ros::debug namespace
+
+*/
diff -r cc8bd7a5eafb roslib_electric/manifest.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roslib_electric/manifest.xml Tue Jun 12 15:24:41 2012 -0700
@@ -0,0 +1,35 @@
+<package>
+ <description brief="ROS base library">
+
+ Base dependencies and support libraries for ROS. roslib contains many of the common data structures and tools that are shared across ROS client library implementations.
+
+ </description>
+ <author>Ken Conley/[email protected], Morgan Quigley/[email protected], Josh Faust/[email protected]</author>
+ <license>BSD</license>
+ <review status="Doc reviewed" notes="2010/01/12"/>
+ <url>http://ros.org/wiki/roslib</url>
+ <export>
+ <cpp cflags="-I${prefix}/msg_gen/cpp/include -I${prefix}/include `rosboost-cfg --cflags`" lflags="-Wl,-rpath,${prefix}/lib -L${prefix}/lib -lroslib"/>
+ <rosdoc config="${prefix}/rosdoc.yaml" />
+ </export>
+ <depend package="rospack"/>
+
+ <!-- for roslib.params -->
+ <rosdep name="python"/>
+ <rosdep name="python-yaml"/>
+
+ <rosdep name="boost"/>
+
+ <platform os="ubuntu" version="9.04"/>
+ <platform os="ubuntu" version="9.10"/>
+ <platform os="ubuntu" version="10.04"/>
+ <platform os="macports" version="macports"/>
+ <rosbuild2>
+ <depend package="rospack"/>
+ <depend package="cpp_common"/>
+ <export>
+ <include_dir>${roslib_SOURCE_DIR}/include</include_dir>
+ <lib>roslib</lib>
+ </export>
+ </rosbuild2>
+</package>
diff -r cc8bd7a5eafb roslib_electric/rosdoc.yaml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roslib_electric/rosdoc.yaml Tue Jun 12 15:24:41 2012 -0700
@@ -0,0 +1,7 @@
+ - builder: epydoc
+ output_dir: python
+ config: epydoc.config
+ - builder: doxygen
+ name: C++ API
+ output_dir: c++
+ file_patterns: '*.c *.cpp *.h *.cc *.hh *.dox'
\ No newline at end of file
diff -r cc8bd7a5eafb roslib_electric/scripts/pythontest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roslib_electric/scripts/pythontest Tue Jun 12 15:24:41 2012 -0700
@@ -0,0 +1,12 @@
+#!/bin/sh
+if [ ! -f /usr/bin/python ] ; then
+ exit 1
+fi
+
+/usr/bin/env python -c "import sys, os; os._exit(float(sys.version[:3])>=2.4);"
+if [ $? -eq 0 ]
+then
+ exit 1
+else
+ exit 0
+fi
diff -r cc8bd7a5eafb roslib_electric/src/package.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roslib_electric/src/package.cpp Tue Jun 12 15:24:41 2012 -0700
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2009, Willow Garage, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names of Stanford University or Willow Garage, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "ros/package.h"
+#include "rospack/rospack.h"
+
+#include <cstdio>
+#include <iostream>
+
+#include <boost/algorithm/string/split.hpp>
+#include <boost/algorithm/string/join.hpp>
+#include <boost/algorithm/string/classification.hpp>
+#include <boost/thread/mutex.hpp>
+
+namespace ros
+{
+namespace package
+{
+
+// Mutex used to lock calls into librospack, which is not thread-safe.
+static boost::mutex librospack_mutex;
+
+std::string command(const std::string& _cmd)
+{
+ boost::mutex::scoped_lock lock(librospack_mutex);
+
+ rospack::ROSPack rp;
+ int ret;
+ try
+ {
+ ret = rp.run(_cmd);
+ if(ret == 0)
+ return rp.getOutput();
+ else {
+ if ( !rp.is_quiet() )
+ std::cerr << "ROSPack::run returned non-zero." << std::endl;
+ }
+ }
+ catch(std::runtime_error &e)
+ {
+ if ( !rp.is_quiet() )
+ std::cerr << "[rospack] " << e.what() << std::endl;
+ }
+ return std::string("");
+}
+
+void command(const std::string& cmd, V_string& output)
+{
+ std::string out_string = command(cmd);
+ V_string full_list;
+ boost::split(full_list, out_string, boost::is_any_of("\r\n"));
+
+ // strip empties
+ V_string::iterator it = full_list.begin();
+ V_string::iterator end = full_list.end();
+ for (; it != end; ++it)
+ {
+ if (!it->empty())
+ {
+ output.push_back(*it);
+ }
+ }
+}
+
+std::string getPath(const std::string& package_name)
+{
+ std::string path = command("find " + package_name);
+
+ // scrape any newlines out of it
+ for (size_t newline = path.find('\n'); newline != std::string::npos;
+ newline = path.find('\n'))
+ {
+ path.erase(newline, 1);
+ }
+
+ return path;
+}
+
+bool getAll(V_string& packages)
+{
+ command("list-names", packages);
+
+ return true;
+}
+
+void getPlugins(const std::string& package, const std::string& attribute, V_string& plugins)
+{
+ M_string plugins_map;
+ getPlugins(package, attribute, plugins_map);
+ M_string::iterator it = plugins_map.begin();
+ M_string::iterator end = plugins_map.end();
+ for (; it != end; ++it)
+ {
+ plugins.push_back(it->second);
+ }
+}
+
+void getPlugins(const std::string& package, const std::string& attribute, M_string& plugins)
+{
+ V_string lines;
+ command("plugins --attrib=" + attribute + " " + package, lines);
+
+ V_string::iterator it = lines.begin();
+ V_string::iterator end = lines.end();
+ for (; it != end; ++it)
+ {
+ V_string tokens;
+ boost::split(tokens, *it, boost::is_any_of(" "));
+
+ if (tokens.size() >= 2)
+ {
+ std::string package = tokens[0];
+ std::string rest = boost::join(V_string(tokens.begin() + 1, tokens.end()), " ");
+ plugins[package] = rest;
+ }
+ }
+}
+
+} // namespace package
+} // namespace ros
diff -r cc8bd7a5eafb roslib_electric/src/ros/__init__.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roslib_electric/src/ros/__init__.py Tue Jun 12 15:24:41 2012 -0700
@@ -0,0 +1,62 @@
+# Software License Agreement (BSD License)
+#
+# Copyright (c) 2008, Willow Garage, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of Willow Garage, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Revision $Id: __init__.py 3544 2009-01-24 00:09:21Z sfkwc $
+
+## The ros module enables dynamic importing of any ROS python module.
+## The common syntax is 'from ros import foo', where foo is a ROS package
+## name.
+
+import sys
+
+import roslib
+
+## @internal
+class Module(object):
+ def __init__(self, wrapped):
+ self.wrapped = wrapped
+
+ def __getattr__(self, name):
+ try:
+ return getattr(self.wrapped, name)
+ except AttributeError:
+ import roslib.packages
+ try:
+ roslib.load_manifest(name.split('.')[0])
+ except roslib.packages.InvalidROSPkgException as e:
+ raise ImportError("Cannot import module '%s': \n%s"%(name, str(e)))
+ return __import__(name)
+
+## rewrite our own entry in sys.modules so that dynamic loading
+## works.
+sys.modules[__name__] = Module(sys.modules[__name__])
+
diff -r cc8bd7a5eafb roslib_electric/src/roslib_electric/__init__.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roslib_electric/src/roslib_electric/__init__.py Tue Jun 12 15:24:41 2012 -0700
@@ -0,0 +1,55 @@
+# Software License Agreement (BSD License)
+#
+# Copyright (c) 2008, Willow Garage, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of Willow Garage, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Revision $Id: __init__.py 14272 2011-07-12 21:56:56Z kwc $
+
+"""
+roslib has a very important role in all Python code written for ROS:
+it contains the L{load_manifest()} method, which updates the
+PYTHONPATH based on a set of ROS Package manifest.xml files. Because
+of this role, roslib is required to be on the PYTHONPATH of every ROS
+installation.
+
+Beyond the important load_manifest() call, most of the rest of roslib
+consists of low-level libraries that 99% of ROS users need not
+interact with. These libraries are primarily to support higher-level
+ROS Python libraries, such as the rospy client library, as well as
+numerous ROS tools (e.g. rostopic).
+
+"""
+
+# from roslib_electric.launcher import load_manifest
+from roslib_electric.scriptutil import is_interactive, set_interactive
+
+# this import is necessary due to a bug in purge_build.py in our
+# debian assets.
+import roslib_electric.stacks
diff -r cc8bd7a5eafb roslib_electric/src/roslib_electric/exceptions.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roslib_electric/src/roslib_electric/exceptions.py Tue Jun 12 15:24:41 2012 -0700
@@ -0,0 +1,44 @@
+# Software License Agreement (BSD License)
+#
+# Copyright (c) 2009, Willow Garage, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of Willow Garage, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Revision $Id: exceptions.py 6490 2009-10-12 21:26:50Z kwc $
+# $Author: kwc $
+
+"""
+Provides the L{ROSLibException} class, which is common to many roslib libraries.
+"""
+
+class ROSLibException(Exception):
+ """
+ Base class for exceptions in roslib
+ """
+ pass
diff -r cc8bd7a5eafb roslib_electric/src/roslib_electric/launcher.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roslib_electric/src/roslib_electric/launcher.py Tue Jun 12 15:24:41 2012 -0700
@@ -0,0 +1,139 @@
+#! /usr/bin/env python
+# Software License Agreement (BSD License)
+#
+# Copyright (c) 2008, Willow Garage, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of Willow Garage, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Revision $Id: launcher.py 14291 2011-07-13 03:24:43Z kwc $
+# $Author: kwc $
+
+"""
+Python path loader for python scripts and applications. Paths are
+derived from dependency structure declared in ROS manifest files.
+"""
+
+import sys
+import os
+
+import roslib_electric.manifest
+import roslib_electric.packages
+
+def get_manifest_file(package_name):
+ """
+ @return: name of package to get manifest for
+ @rtype: str
+ @raise InvalidROSPkgException: if required is True and package cannot be located
+ """
+ return roslib_electric.manifest.manifest_file(package_name, required=True)
+
+# bootstrapped keeps track of which packages we've loaded so we don't update the path multiple times
+_bootstrapped = []
+
+def load_manifest(package_name, bootstrap_version="0.7"):
+ """
+ Update the Python sys.path with package's dependencies
+ @param package_name: name of the package that load_manifest() is being called from.
+ @type package_name: str
+ @param bootstrap_version: (keyword argument) do not use. Soon to be deprecated
+ @type bootstrap_version: str
+ """
+ if package_name in _bootstrapped:
+ return
+ prefix = []
+ if 'ROS_BUILD' in os.environ:
+ if os.environ['ROS_BUILD'] == os.environ['ROS_ROOT']:
+ return
+ prefix = [os.path.join(os.environ['ROS_BUILD'], 'gen', 'py'),
+ os.path.join(os.environ['ROS_BUILD'], '..', 'rosidl', 'src')]
+ sys.path = prefix + _generate_python_path(package_name, [], os.environ) + sys.path
+
+def _append_package_paths(manifest_, paths, pkg_dir):
+ """
+ Added paths for package to paths
+ @param manifest_: package manifest
+ @type manifest_: Manifest
+ @param pkg_dir: package's filesystem directory path
+ @type pkg_dir: str
+ @param paths: list of paths
+ @type paths: [str]
+ """
+ exports = manifest_.get_export('python','path')
+ if exports:
+ for export in exports:
+ if ':' in export:
+ export = export.split(':')
+ else:
+ export = [export]
+ for e in export:
+ paths.append(e.replace('${prefix}', pkg_dir))
+ else:
+ dirs = [os.path.join(pkg_dir, d) for d in ['src', 'lib']]
+ paths.extend(list(filter(os.path.isdir, dirs))) #py3k
+
+def _generate_python_path(pkg, depends, env=os.environ):
+ """
+ Recursive subroutine for building dependency list and python path
+ @param manifest_file: manifest to parse for additional dependencies
+ @param depends: current dependency set. Will be modified
+ @return: list of directory paths to add to python path in order to include
+ package and dependencies described in manifest file.
+ @raise InvalidROSPkgException: if an error occurs while attempting to load package or dependencies
+ """
+ if pkg in _bootstrapped:
+ return []
+ manifest_file = roslib_electric.manifest.manifest_file(pkg, True, env)
+ if not manifest_file:
+ raise roslib_electric.packages.InvalidROSPkgException("cannot locate package [%s]"%pkg)
+ _bootstrapped.append(pkg)
+
+ pkg_dir = os.path.dirname(os.path.abspath(manifest_file))
+ depends.append(pkg)
+ m = roslib_electric.manifest.parse_file(manifest_file)
+
+ paths = []
+ _append_package_paths(m, paths, pkg_dir)
+
+ try:
+ for d in m.depends:
+ if d.package in depends:
+ continue
+ try: #add sub-dependencies to paths and depends
+ paths.extend(_generate_python_path(d.package, depends, env))
+ except roslib_electric.packages.InvalidROSPkgException as e:
+ # translate error message to give more context
+ raise roslib_electric.packages.InvalidROSPkgException("While loading package '%s': %s"%(d.package, str(e)))
+ except:
+ import traceback
+ raise roslib_electric.packages.InvalidROSPkgException("While loading package '%s': cannot load dependency '%s'\nLower level error was %s"%(pkg, d.package, traceback.format_exc()))
+ except:
+ if pkg in _bootstrapped:
+ _bootstrapped.remove(pkg)
+ raise
+ return paths
diff -r cc8bd7a5eafb roslib_electric/src/roslib_electric/manifest.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roslib_electric/src/roslib_electric/manifest.py Tue Jun 12 15:24:41 2012 -0700
@@ -0,0 +1,152 @@
+#! /usr/bin/env python
+# Software License Agreement (BSD License)
+#
+# Copyright (c) 2008, Willow Garage, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of Willow Garage, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Revision $Id: manifest.py 14291 2011-07-13 03:24:43Z kwc $
+# $Author: kwc $
+
+"""
+Python parser for rospack manifest.xml files. See U{http://ros.org/wiki/Manifest}
+"""
+
+import sys
+import os
+import getopt
+
+import roslib_electric.exceptions
+import roslib_electric.packages
+import roslib_electric.rosenv
+
+MANIFEST_FILE = 'manifest.xml'
+
+import roslib_electric.manifestlib
+# re-export symbols for backwards compatibility
+from roslib_electric.manifestlib import ManifestException, Depend, Export, ROSDep, VersionControl
+
+class Manifest(roslib_electric.manifestlib._Manifest):
+ """
+ Object representation of a ROS manifest file
+ """
+ __slots__ = []
+ def __init__(self):
+ """
+ Initialize new empty manifest.
+ """
+ super(Manifest, self).__init__('package')
+
+ def get_export(self, tag, attr):
+ """
+ @return: exports that match the specified tag and attribute, e.g. 'python', 'path'
+ @rtype: [L{Export}]
+ """
+ return [e.get(attr) for e in self.exports if e.tag == tag if e.get(attr) is not None]
+
+def _manifest_file_by_dir(package_dir, required=True, env=None):
+ """
+ @param package_dir: path to package directory
+ @type package_dir: str
+ @param env: environment dictionary
+ @type env: dict
+ @param required: require that the directory exist
+ @type required: bool
+ @return: path to manifest file of package
+ @rtype: str
+ @raise InvalidROSPkgException: if required is True and manifest file cannot be located
+ """
+ if env is None:
+ env = os.environ
+ try:
+ p = os.path.join(package_dir, MANIFEST_FILE)
+ if not required and not os.path.exists(p):
+ return p
+ if not os.path.isfile(p):
+ raise roslib_electric.packages.InvalidROSPkgException("""
+Package '%(package_dir)s' is improperly configured: no manifest file is present.
+"""%locals())
+ return p
+ except roslib_electric.packages.InvalidROSPkgException as e:
+ if required:
+ raise
+
+def manifest_file(package, required=True, env=None):
+ """
+ @param package str: package name
+ @type package: str
+ @param env: override os.environ dictionary
+ @type env: dict
+ @param required: require that the directory exist
+ @type required: bool
+ @return: path to manifest file of package
+ @rtype: str
+ @raise InvalidROSPkgException: if required is True and manifest file cannot be located
+ """
+ # ros_root needs to be determined from the environment or else
+ # everything breaks when trying to launch nodes via ssh where the
+ # path isn't setup correctly.
+ if env is None:
+ env = os.environ
+ d = roslib_electric.packages.get_pkg_dir(package, required, ros_root=env[roslib_electric.rosenv.ROS_ROOT])
+ return _manifest_file_by_dir(d, required=required, env=env)
+
+def load_manifest(package):
+ """
+ Load manifest for specified package.
+ @param pacakge: package name
+ @type package: str
+ @return: Manifest instance
+ @rtype: L{Manifest}
+ @raise InvalidROSPkgException: if package is unknown
+ """
+ return parse_file(manifest_file(package))
+
+def parse_file(file):
+ """
+ Parse manifest.xml file
+ @param file: manifest.xml file path
+ @type file: str
+ @return: Manifest instance
+ @rtype: L{Manifest}
+ """
+ return roslib_electric.manifestlib.parse_file(Manifest(), file)
+