Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | # You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 4 | |
michael@0 | 5 | from __future__ import unicode_literals |
michael@0 | 6 | |
michael@0 | 7 | import string |
michael@0 | 8 | |
michael@0 | 9 | manifest_template = """# THIS FILE IS AUTOGENERATED BY ${caller} - DO NOT EDIT |
michael@0 | 10 | [DEFAULT] |
michael@0 | 11 | support-files = |
michael@0 | 12 | ${supportfiles} |
michael@0 | 13 | |
michael@0 | 14 | ${tests} |
michael@0 | 15 | """ |
michael@0 | 16 | |
michael@0 | 17 | reftest_template = """# THIS FILE IS AUTOGENERATED BY ${caller} - DO NOT EDIT |
michael@0 | 18 | |
michael@0 | 19 | ${reftests} |
michael@0 | 20 | """ |
michael@0 | 21 | |
michael@0 | 22 | |
michael@0 | 23 | |
michael@0 | 24 | def substManifest(caller, test_files, support_files): |
michael@0 | 25 | test_files = [f.lstrip('/') for f in test_files] |
michael@0 | 26 | support_files = [f.lstrip('/') for f in support_files] |
michael@0 | 27 | |
michael@0 | 28 | return string.Template(manifest_template).substitute({ |
michael@0 | 29 | 'caller': caller, |
michael@0 | 30 | 'supportfiles': '\n'.join(' %s' % f for f in sorted(support_files)), |
michael@0 | 31 | 'tests': '\n'.join('[%s]' % f for f in sorted(test_files)) |
michael@0 | 32 | }) |
michael@0 | 33 | |
michael@0 | 34 | |
michael@0 | 35 | def substReftestList(caller, tests): |
michael@0 | 36 | def reftests(tests): |
michael@0 | 37 | return "\n".join(" ".join(line) for line in tests) |
michael@0 | 38 | |
michael@0 | 39 | return string.Template(reftest_template).substitute({ |
michael@0 | 40 | "caller": caller, |
michael@0 | 41 | "reftests": reftests(tests), |
michael@0 | 42 | }) |
michael@0 | 43 |