Ansible job definitions for OpenStack projects CI systems
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.

59 lines
2.3KB

  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. import argparse
  14. import os
  15. import sys
  16. from ZanataUtils import IniConfig, ProjectConfig
  17. def get_args():
  18. parser = argparse.ArgumentParser(description='Generate a zanata.xml '
  19. 'file for this project so we can '
  20. 'process translations')
  21. parser.add_argument('-p', '--project')
  22. parser.add_argument('-v', '--version')
  23. parser.add_argument('-s', '--srcdir')
  24. parser.add_argument('-d', '--txdir')
  25. parser.add_argument('-e', '--excludes')
  26. parser.add_argument('-r', '--rule', nargs=2, metavar=('PATTERN', 'RULE'),
  27. action='append',
  28. help='Append a rule, used by the Zanata client to '
  29. 'match .pot files to translations. Can be specified '
  30. 'multiple times, and if no rules are specified a '
  31. 'default will be used.')
  32. parser.add_argument('--no-verify', action='store_false', dest='verify',
  33. help='Do not perform HTTPS certificate verification')
  34. parser.add_argument('-f', '--file', required=True)
  35. return parser.parse_args()
  36. def main():
  37. args = get_args()
  38. default_rule = ('**/*.pot',
  39. '{locale_with_underscore}/LC_MESSAGES/{filename}.po')
  40. rules = args.rule or [default_rule]
  41. try:
  42. zc = IniConfig(os.path.expanduser('~/.config/zanata.ini'))
  43. ProjectConfig(zc, args.file, rules, args.verify, project=args.project,
  44. version=args.version,
  45. srcdir=args.srcdir, txdir=args.txdir,
  46. excludes=args.excludes)
  47. except ValueError as e:
  48. sys.exit(e)
  49. if __name__ == '__main__':
  50. main()