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 = {"Ioan Sucan" : "isucan",
12  "Michael Ferguson" : "mikeferguson",
13  "Sachin Chitta" : "sachinchitta",
14  "G.A. vd. Hoorn" : "gavanderhoorn",
15  "Dave Coleman" : "davetcoleman",
16  "Acorn Pooley" : "acorn",
17  "Jon Binney" : "jonbinney",
18  "Matei Ciocarlie" : "mateiciocarlie",
19  "Michael Görner".decode('utf8') : "v4hn",
20  "Robert Haschke" : "rhaschke",
21  "Ian McMahon" : "IanTheEngineer",
22  "Isaac I. Y. Saito" : "130s",
23  "Mathias Lüdtke".decode('utf8') : "ipa-mdl",
24  "Ryan Luna" : "ryanluna",
25  "Chittaranjan Srinivas Swaminathan" : "ksatyaki",
26  "Chittaranjan S Srinivas" : "ksatyaki"
27 }
28 
29 def eprint(*args, **kwargs):
30  print(*args, file=sys.stderr, **kwargs)
31 
32 def author_to_github(maintainer):
33  try:
34  name = maintainers_dict[maintainer.name]
35  except KeyError:
36  eprint( "Missing maintainer: ", maintainer.name)
37  name = maintainer.email
38  return name
39 
40 def template_file(src, dst, subs):
41  print("++ Templating '{0}'".format(src))
42  with open(src, 'r') as f:
43  data = f.read()
44  for k, v in subs.items():
45  data = data.replace(k, v)
46  with open(dst, 'w+') as f:
47  f.write(data)
48  print("++ Webpage ready at '{0}'".format(dst))
49  webbrowser.open(dst)
50 
51 def create_travis_badge(package_name):
52  output = ''
53  # Indigo
54  output += "<td>"
55  output += "<a href='http://build.ros.org/view/Isrc_uT/job/Isrc_uT__" + package_name + "__ubuntu_trusty__source/'><img src='http://build.ros.org/buildStatus/icon?job=Isrc_uT__" + package_name + "__ubuntu_trusty__source'></a>"
56  output += "</td><td>"
57  output += "<a href='http://build.ros.org/view/Ibin_uT64/job/Ibin_uT64__" + package_name + "__ubuntu_trusty_amd64__binary/'><img src='http://build.ros.org/buildStatus/icon?job=Ibin_uT64__" + package_name + "__ubuntu_trusty_amd64__binary'></a>"
58  output += "</td>"
59 
60  # Jade
61  output += "<td>"
62  output += "<a href='http://build.ros.org/view/Jsrc_uT/job/Jsrc_uT__" + package_name + "__ubuntu_trusty__source/'><img src='http://build.ros.org/buildStatus/icon?job=Jsrc_uT__" + package_name + "__ubuntu_trusty__source'></a>"
63  output += "</td><td>"
64  output += "<a href='http://build.ros.org/view/Jbin_uT64/job/Jbin_uT64__" + package_name + "__ubuntu_trusty_amd64__binary/'><img src='http://build.ros.org/buildStatus/icon?job=Jbin_uT64__" + package_name + "__ubuntu_trusty_amd64__binary'></a>"
65  output += "</td>"
66 
67  # Kinetic
68  output += "<td>"
69  output += "<a href='http://build.ros.org/view/Ksrc_uX/job/Ksrc_uX__" + package_name + "__ubuntu_xenial__source/'><img src='http://build.ros.org/buildStatus/icon?job=Ksrc_uX__" + package_name + "__ubuntu_xenial__source'></a>"
70  output += "</td><td>"
71  output += "<a href='http://build.ros.org/view/Kbin_uX64/job/Kbin_uX64__" + package_name + "__ubuntu_xenial_amd64__binary/'><img src='http://build.ros.org/buildStatus/icon?job=Kbin_uX64__" + package_name + "__ubuntu_xenial_amd64__binary'></a>"
72  output += "</td>"
73  return output
74 
75 def get_first_folder(path) :
76  head,tail = os.path.split(path)
77  components = []
78  while len(tail)>0:
79  components.insert(0,tail)
80  head,tail = os.path.split(head)
81  return components[0]
82 
83 def populate_package_data(path, package):
84  output = "<td><a href='https://github.com/ros-planning/" + get_first_folder(path) + "'>" + package.name + "</a></td>"
85  output += "<td>" + package.version + "</td>"
86  output += "<td>"
87  first = True
88  for maintainer in package.maintainers:
89  author = author_to_github(maintainer)
90  if first:
91  first = False
92  else:
93  output += ", "
94  output += "<a href='https://github.com/" + author + "'>" + author + "</a>"
95  output += "</td>"
96  output += create_travis_badge(package.name)
97  return output
98 
100  """
101  Creates MoveIt! List
102  """
103  output = ''
104  packages = find_packages(os.getcwd())
105 
106  for path, package in packages.items():
107  output += "<tr>"
108  output += populate_package_data(path, package)
109  output += "</tr>"
110 
111  # Save to file
112  basepath = os.path.dirname(os.path.realpath(__file__))
113  template_file(os.path.join(basepath, 'maintainer_table_template.html'),
114  os.path.join(basepath, 'index.html'),
115  {'CONTENTS' : output})
116 
117 
118 if __name__ == "__main__":
119  sys.exit(list_moveit_packages())
def template_file(src, dst, subs)
def populate_package_data(path, package)
def create_travis_badge(package_name)


moveit
Author(s): Ioan Sucan , Sachin Chitta
autogenerated on Wed Jul 10 2019 04:04:48