OpenStack IRC meetings schedule
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

66 lines
1.8 KiB

  1. #!/usr/bin/env python
  2. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  3. # not use this file except in compliance with the License. You may obtain
  4. # a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software
  9. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  10. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  11. # License for the specific language governing permissions and limitations
  12. # under the License.
  13. from __future__ import print_function
  14. import argparse
  15. import textwrap
  16. import requests
  17. import yaml
  18. PROJECTS_LIST = "http://git.openstack.org/cgit/openstack/governance/plain/reference/projects.yaml" # noqa
  19. def main():
  20. parser = argparse.ArgumentParser()
  21. parser.add_argument(
  22. '--project-list',
  23. default=PROJECTS_LIST,
  24. help='a URL pointing to a projects.yaml file, defaults to %(default)s',
  25. )
  26. parser.add_argument(
  27. '--msg', '-m',
  28. default='courtesy ping for',
  29. help='ping message',
  30. )
  31. parser.add_argument(
  32. 'project',
  33. default=None,
  34. nargs='*',
  35. help='projects to include, defaults to all',
  36. )
  37. args = parser.parse_args()
  38. r = requests.get(args.project_list)
  39. project_data = yaml.load(r.text)
  40. projects = args.project
  41. if not projects:
  42. projects = project_data.keys()
  43. nick_text = ' '.join([
  44. project_data[p]['ptl']['irc'] for p in projects
  45. ])
  46. print(textwrap.fill(nick_text,
  47. initial_indent=args.msg + ' ',
  48. subsequent_indent=args.msg + ' ',
  49. width=80,
  50. ))
  51. if __name__ == '__main__':
  52. main()