| Home | Trees | Indices | Help |
|---|
|
|
1 # Software License Agreement (BSD License)
2 #
3 # Copyright (c) 2009, Willow Garage, Inc.
4 # All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 #
10 # * Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # * Redistributions in binary form must reproduce the above
13 # copyright notice, this list of conditions and the following
14 # disclaimer in the documentation and/or other materials provided
15 # with the distribution.
16 # * Neither the name of Willow Garage, Inc. nor the names of its
17 # contributors may be used to endorse or promote products derived
18 # from this software without specific prior written permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 # POSSIBILITY OF SUCH DAMAGE.
32 #
33 # Revision $Id: packages.py 6258 2009-09-22 22:08:20Z kwc $
34
35 import os
36 import time
37
38 from roswtf.environment import paths, is_executable
39 from roswtf.rules import warning_rule, error_rule
40
41 import rospkg
42
43 _packages_of_cache = {}
45 if d in _packages_of_cache:
46 return _packages_of_cache[d]
47 else:
48 _packages_of_cache[d] = pkgs = rosstack.packages_of(d)
49 return pkgs
50
52 # This rule should probably be cache optimized
53 errors = []
54 rospack = rospkg.RosPack()
55 rosstack = rospkg.RosStack()
56
57 stack_list = rosstack.list()
58 #print stack_list
59 for s in ctx.stacks:
60 try:
61 s_deps = []
62 s_pkgs = _packages_of(rosstack, s)
63 for p in s_pkgs:
64 s_deps.extend(rospack.get_depends(p, implicit=False))
65 m = rosstack.get_manifest(s)
66 m_file = os.path.join(rosstack.get_path(s), 'stack.xml')
67 for d in m.depends:
68 if not d.name in stack_list:
69 errors.append("%s (%s does not exist)"%(m_file, d))
70 elif d.name in ['ros', 'ros_comm']:
71 # ros dependency always exists. ros_comm
72 # dependency has implicit connections (msggen), so
73 # we ignore.
74 continue
75 else:
76 pkgs = _packages_of(rosstack, d.name)
77 # check no longer works due to rosdeps chains
78 #if not [p for p in pkgs if p in s_deps]:
79 # errors.append("%s (%s appears to be an unnecessary depend)"%(m_file, d))
80 except rospkg.ResourceNotFound:
81 # report with a different rule
82 pass
83 return errors
84
85 warnings = [
86 (manifest_depends, "The following stack.xml file list invalid dependencies:"),
87
88 ]
89 errors = [
90 ]
91
93 # no package in context to verify
94 if not ctx.stacks:
95 return
96
97 for r in warnings:
98 warning_rule(r, r[0](ctx), ctx)
99 for r in errors:
100 error_rule(r, r[0](ctx), ctx)
101
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Tue Mar 7 03:45:59 2017 | http://epydoc.sourceforge.net |