create_maintainer_table.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 from __future__ import print_function
5 import os
6 import sys
7 import catkin_pkg
8 import webbrowser
9 from catkin_pkg.packages import find_packages
10 
11 maintainers_dict = {
12  "Ioan Sucan": "isucan",
13  "Michael Ferguson": "mikeferguson",
14  "Sachin Chitta": "sachinchitta",
15  "G.A. vd. Hoorn": "gavanderhoorn",
16  "Dave Coleman": "davetcoleman",
17  "Acorn Pooley": "acorn",
18  "Jon Binney": "jonbinney",
19  "Matei Ciocarlie": "mateiciocarlie",
20  "Michael Görner".decode("utf8"): "v4hn",
21  "Robert Haschke": "rhaschke",
22  "Ian McMahon": "IanTheEngineer",
23  "Isaac I. Y. Saito": "130s",
24  "Mathias Lüdtke".decode("utf8"): "ipa-mdl",
25  "Ryan Luna": "ryanluna",
26  "Chittaranjan Srinivas Swaminathan": "ksatyaki",
27  "Chittaranjan S Srinivas": "ksatyaki",
28 }
29 
30 
31 def eprint(*args, **kwargs):
32  print(*args, file=sys.stderr, **kwargs)
33 
34 
35 def author_to_github(maintainer):
36  try:
37  name = maintainers_dict[maintainer.name]
38  except KeyError:
39  eprint("Missing maintainer: ", maintainer.name)
40  name = maintainer.email
41  return name
42 
43 
44 def template_file(src, dst, subs):
45  print("++ Templating '{0}'".format(src))
46  with open(src, "r") as f:
47  data = f.read()
48  for k, v in subs.items():
49  data = data.replace(k, v)
50  with open(dst, "w+") as f:
51  f.write(data)
52  print("++ Webpage ready at '{0}'".format(dst))
53  webbrowser.open(dst)
54 
55 
56 def create_travis_badge(package_name):
57  output = ""
58  # Indigo
59  output += "<td>"
60  output += (
61  "<a href='http://build.ros.org/view/Isrc_uT/job/Isrc_uT__"
62  + package_name
63  + "__ubuntu_trusty__source/'><img src='http://build.ros.org/buildStatus/icon?job=Isrc_uT__"
64  + package_name
65  + "__ubuntu_trusty__source'></a>"
66  )
67  output += "</td><td>"
68  output += (
69  "<a href='http://build.ros.org/view/Ibin_uT64/job/Ibin_uT64__"
70  + package_name
71  + "__ubuntu_trusty_amd64__binary/'><img src='http://build.ros.org/buildStatus/icon?job=Ibin_uT64__"
72  + package_name
73  + "__ubuntu_trusty_amd64__binary'></a>"
74  )
75  output += "</td>"
76 
77  # Jade
78  output += "<td>"
79  output += (
80  "<a href='http://build.ros.org/view/Jsrc_uT/job/Jsrc_uT__"
81  + package_name
82  + "__ubuntu_trusty__source/'><img src='http://build.ros.org/buildStatus/icon?job=Jsrc_uT__"
83  + package_name
84  + "__ubuntu_trusty__source'></a>"
85  )
86  output += "</td><td>"
87  output += (
88  "<a href='http://build.ros.org/view/Jbin_uT64/job/Jbin_uT64__"
89  + package_name
90  + "__ubuntu_trusty_amd64__binary/'><img src='http://build.ros.org/buildStatus/icon?job=Jbin_uT64__"
91  + package_name
92  + "__ubuntu_trusty_amd64__binary'></a>"
93  )
94  output += "</td>"
95 
96  # Kinetic
97  output += "<td>"
98  output += (
99  "<a href='http://build.ros.org/view/Ksrc_uX/job/Ksrc_uX__"
100  + package_name
101  + "__ubuntu_xenial__source/'><img src='http://build.ros.org/buildStatus/icon?job=Ksrc_uX__"
102  + package_name
103  + "__ubuntu_xenial__source'></a>"
104  )
105  output += "</td><td>"
106  output += (
107  "<a href='http://build.ros.org/view/Kbin_uX64/job/Kbin_uX64__"
108  + package_name
109  + "__ubuntu_xenial_amd64__binary/'><img src='http://build.ros.org/buildStatus/icon?job=Kbin_uX64__"
110  + package_name
111  + "__ubuntu_xenial_amd64__binary'></a>"
112  )
113  output += "</td>"
114  return output
115 
116 
118  head, tail = os.path.split(path)
119  components = []
120  while len(tail) > 0:
121  components.insert(0, tail)
122  head, tail = os.path.split(head)
123  return components[0]
124 
125 
126 def populate_package_data(path, package):
127  output = (
128  "<td><a href='https://github.com/moveit/"
129  + get_first_folder(path)
130  + "'>"
131  + package.name
132  + "</a></td>"
133  )
134  output += "<td>" + package.version + "</td>"
135  output += "<td>"
136  first = True
137  for maintainer in package.maintainers:
138  author = author_to_github(maintainer)
139  if first:
140  first = False
141  else:
142  output += ", "
143  output += "<a href='https://github.com/" + author + "'>" + author + "</a>"
144  output += "</td>"
145  output += create_travis_badge(package.name)
146  return output
147 
148 
150  """
151  Creates MoveIt List
152  """
153  output = ""
154  packages = find_packages(os.getcwd())
155 
156  for path, package in packages.items():
157  output += "<tr>"
158  output += populate_package_data(path, package)
159  output += "</tr>"
160 
161  # Save to file
162  basepath = os.path.dirname(os.path.realpath(__file__))
164  os.path.join(basepath, "maintainer_table_template.html"),
165  os.path.join(basepath, "index.html"),
166  {"CONTENTS": output},
167  )
168 
169 
170 if __name__ == "__main__":
171  sys.exit(list_moveit_packages())
create_maintainer_table.template_file
def template_file(src, dst, subs)
Definition: create_maintainer_table.py:44
create_maintainer_table.get_first_folder
def get_first_folder(path)
Definition: create_maintainer_table.py:117
create_maintainer_table.create_travis_badge
def create_travis_badge(package_name)
Definition: create_maintainer_table.py:56
create_maintainer_table.author_to_github
def author_to_github(maintainer)
Definition: create_maintainer_table.py:35
create_maintainer_table.list_moveit_packages
def list_moveit_packages()
Definition: create_maintainer_table.py:149
create_maintainer_table.populate_package_data
def populate_package_data(path, package)
Definition: create_maintainer_table.py:126
create_maintainer_table.eprint
def eprint(*args, **kwargs)
Definition: create_maintainer_table.py:31


moveit
Author(s): Ioan Sucan , Sachin Chitta
autogenerated on Sat May 3 2025 02:28:52