moveit2
The MoveIt Motion Planning Framework for ROS 2.
create_maintainer_table.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 # Copyright 2021 PickNik Inc.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are met:
8 #
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 #
12 # * Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15 #
16 # * Neither the name of the PickNik Inc. nor the names of its
17 # contributors may be used to endorse or promote products derived from
18 # this software without specific prior written permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 # POSSIBILITY OF SUCH DAMAGE.
31 
32 
33 from __future__ import print_function
34 
35 import os
36 import sys
37 import webbrowser
38 
39 from catkin_pkg.packages import find_packages
40 
41 maintainers_dict = {
42  "Ioan Sucan": "isucan",
43  "Michael Ferguson": "mikeferguson",
44  "Sachin Chitta": "sachinchitta",
45  "G.A. vd. Hoorn": "gavanderhoorn",
46  "Dave Coleman": "davetcoleman",
47  "Acorn Pooley": "acorn",
48  "Jon Binney": "jonbinney",
49  "Matei Ciocarlie": "mateiciocarlie",
50  "Michael Görner".decode("utf8"): "v4hn",
51  "Robert Haschke": "rhaschke",
52  "Ian McMahon": "IanTheEngineer",
53  "Isaac I. Y. Saito": "130s",
54  "Mathias Lüdtke".decode("utf8"): "ipa-mdl",
55  "Ryan Luna": "ryanluna",
56  "Chittaranjan Srinivas Swaminathan": "ksatyaki",
57  "Chittaranjan S Srinivas": "ksatyaki",
58 }
59 
60 
61 def eprint(*args, **kwargs):
62  print(*args, file=sys.stderr, **kwargs)
63 
64 
65 def author_to_github(maintainer):
66  try:
67  name = maintainers_dict[maintainer.name]
68  except KeyError:
69  eprint("Missing maintainer: ", maintainer.name)
70  name = maintainer.email
71  return name
72 
73 
74 def template_file(src, dst, subs):
75  print("++ Templating '{0}'".format(src))
76  with open(src, "r") as f:
77  data = f.read()
78  for k, v in subs.items():
79  data = data.replace(k, v)
80  with open(dst, "w+") as f:
81  f.write(data)
82  print("++ Webpage ready at '{0}'".format(dst))
83  webbrowser.open(dst)
84 
85 
86 def create_travis_badge(package_name):
87  output = ""
88  # Indigo
89  output += "<td>"
90  output += (
91  "<a href='http://build.ros.org/view/Isrc_uT/job/Isrc_uT__"
92  + package_name
93  + "__ubuntu_trusty__source/'>"
94  "<img src='http://build.ros.org/buildStatus/icon?job=Isrc_uT__"
95  + package_name
96  + "__ubuntu_trusty__source'></a>"
97  )
98  output += "</td><td>"
99  output += (
100  "<a href='http://build.ros.org/view/Ibin_uT64/job/Ibin_uT64__"
101  + package_name
102  + "__ubuntu_trusty_amd64__binary/'>"
103  "<img src='http://build.ros.org/buildStatus/icon?job=Ibin_uT64__"
104  + package_name
105  + "__ubuntu_trusty_amd64__binary'></a>"
106  )
107  output += "</td>"
108 
109  # Jade
110  output += "<td>"
111  output += (
112  "<a href='http://build.ros.org/view/Jsrc_uT/job/Jsrc_uT__"
113  + package_name
114  + "__ubuntu_trusty__source/'>"
115  "<img src='http://build.ros.org/buildStatus/icon?job=Jsrc_uT__"
116  + package_name
117  + "__ubuntu_trusty__source'></a>"
118  )
119  output += "</td><td>"
120  output += (
121  "<a href='http://build.ros.org/view/Jbin_uT64/job/Jbin_uT64__"
122  + package_name
123  + "__ubuntu_trusty_amd64__binary/'>"
124  "<img src='http://build.ros.org/buildStatus/icon?job=Jbin_uT64__"
125  + package_name
126  + "__ubuntu_trusty_amd64__binary'></a>"
127  )
128  output += "</td>"
129 
130  # Kinetic
131  output += "<td>"
132  output += (
133  "<a href='http://build.ros.org/view/Ksrc_uX/job/Ksrc_uX__"
134  + package_name
135  + "__ubuntu_xenial__source/'>"
136  "<img src='http://build.ros.org/buildStatus/icon?job=Ksrc_uX__"
137  + package_name
138  + "__ubuntu_xenial__source'></a>"
139  )
140  output += "</td><td>"
141  output += (
142  "<a href='http://build.ros.org/view/Kbin_uX64/job/Kbin_uX64__"
143  + package_name
144  + "__ubuntu_xenial_amd64__binary/'>"
145  "<img src='http://build.ros.org/buildStatus/icon?job=Kbin_uX64__"
146  + package_name
147  + "__ubuntu_xenial_amd64__binary'></a>"
148  )
149  output += "</td>"
150  return output
151 
152 
154  head, tail = os.path.split(path)
155  components = []
156  while len(tail) > 0:
157  components.insert(0, tail)
158  head, tail = os.path.split(head)
159  return components[0]
160 
161 
162 def populate_package_data(path, package):
163  output = (
164  "<td><a href='https://github.com/ros-planning/"
165  + get_first_folder(path)
166  + "'>"
167  + package.name
168  + "</a></td>"
169  )
170  output += "<td>" + package.version + "</td>"
171  output += "<td>"
172  first = True
173  for maintainer in package.maintainers:
174  author = author_to_github(maintainer)
175  if first:
176  first = False
177  else:
178  output += ", "
179  output += "<a href='https://github.com/" + author + "'>" + author + "</a>"
180  output += "</td>"
181  output += create_travis_badge(package.name)
182  return output
183 
184 
186  """Create list of MoveIt packages."""
187  output = ""
188  packages = find_packages(os.getcwd())
189 
190  for path, package in packages.items():
191  output += "<tr>"
192  output += populate_package_data(path, package)
193  output += "</tr>"
194 
195  # Save to file
196  basepath = os.path.dirname(os.path.realpath(__file__))
198  os.path.join(basepath, "maintainer_table_template.html"),
199  os.path.join(basepath, "index.html"),
200  {"CONTENTS": output},
201  )
202 
203 
204 if __name__ == "__main__":
205  sys.exit(list_moveit_packages())
def create_travis_badge(package_name)
def template_file(src, dst, subs)
def populate_package_data(path, package)
void print(PropagationDistanceField &pdf, int numX, int numY, int numZ)