get_all_depends.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Software License Agreement (BSD License)
4 #
5 # Copyright (c) 2015, JSK Robotics Laboratory.
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
10 # are met:
11 #
12 # * Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # * Redistributions in binary form must reproduce the above
15 # copyright notice, this list of conditions and the following
16 # disclaimer in the documentation and/or other materials provided
17 # with the distribution.
18 # * Neither the name of JSK Robotics Laboratory. nor the names of its
19 # contributors may be used to endorse or promote products derived
20 # from this software without specific prior written permission.
21 #
22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 # POSSIBILITY OF SUCH DAMAGE.
34 #
35 
36 import sys
37 import argparse
38 
39 from geneus.geneus_main import package_depends
40 # we need this for geneus <= 2.2.2 (hydro release)
41 import geneus.geneus_main
42 if geneus.geneus_main.pkg_map is None:
43  geneus.geneus_main.pkg_map = geneus.geneus_main.get_pkg_map()
44 # we need this for geneus <= 2.2.4
46  from catkin_pkg import packages, workspaces
47  pkg_map = {}
48  for ws in workspaces.get_spaces():
49  pkgs = packages.find_packages(ws)
50  for pkg in pkgs.values():
51  if not pkg_map.has_key(pkg.name):
52  pkg_map[pkg.name] = pkg
53  return pkg_map
54 geneus.geneus_main.pkg_map = get_pkg_map()
55 
56 
57 def _get_output(package):
58  depends = package_depends(package)
59  depends = ['"{0}"'.format(d) for d in depends]
60  output = [
61  r'set({pkg}_ALL_RUN_DEPENDS {depends})'.format(
62  pkg=package, depends=' '.join(depends))
63  ]
64  return output
65 
66 
67 def main():
68  parser = argparse.ArgumentParser(
69  description="Extract all dependencies to output file.")
70  parser.add_argument('package')
71  parser.add_argument('outfile')
72  args = parser.parse_args(sys.argv[1:])
73 
74  lines = _get_output(package=args.package)
75  with open(args.outfile, 'w') as ofile:
76  ofile.write('\n'.join(lines))
77 
78 
79 if __name__ == '__main__':
80  main()
def _get_output(package)


roseus
Author(s): Kei Okada
autogenerated on Thu Apr 4 2019 02:55:35