l10n.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # This Source Code Form is subject to the terms of the Mozilla Public
  2. # License, v. 2.0. If a copy of the MPL was not distributed with this
  3. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  4. """
  5. Do transforms specific to l10n kind
  6. """
  7. from __future__ import absolute_import, print_function, unicode_literals
  8. from taskgraph.transforms.base import TransformSequence
  9. transforms = TransformSequence()
  10. @transforms.add
  11. def mh_config_replace_project(config, jobs):
  12. """ Replaces {project} in mh config entries with the current project """
  13. # XXXCallek This is a bad pattern but exists to satisfy ease-of-porting for buildbot
  14. for job in jobs:
  15. if not job['run'].get('using') == 'mozharness':
  16. # Nothing to do, not mozharness
  17. yield job
  18. continue
  19. job['run']['config'] = map(
  20. lambda x: x.format(project=config.params['project']),
  21. job['run']['config']
  22. )
  23. yield job
  24. @transforms.add
  25. def mh_options_replace_project(config, jobs):
  26. """ Replaces {project} in mh option entries with the current project """
  27. # XXXCallek This is a bad pattern but exists to satisfy ease-of-porting for buildbot
  28. for job in jobs:
  29. if not job['run'].get('using') == 'mozharness':
  30. # Nothing to do, not mozharness
  31. yield job
  32. continue
  33. job['run']['options'] = map(
  34. lambda x: x.format(project=config.params['project']),
  35. job['run']['options']
  36. )
  37. yield job