michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: # You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: from __future__ import unicode_literals michael@0: michael@0: import string michael@0: michael@0: manifest_template = """# THIS FILE IS AUTOGENERATED BY ${caller} - DO NOT EDIT michael@0: [DEFAULT] michael@0: support-files = michael@0: ${supportfiles} michael@0: michael@0: ${tests} michael@0: """ michael@0: michael@0: reftest_template = """# THIS FILE IS AUTOGENERATED BY ${caller} - DO NOT EDIT michael@0: michael@0: ${reftests} michael@0: """ michael@0: michael@0: michael@0: michael@0: def substManifest(caller, test_files, support_files): michael@0: test_files = [f.lstrip('/') for f in test_files] michael@0: support_files = [f.lstrip('/') for f in support_files] michael@0: michael@0: return string.Template(manifest_template).substitute({ michael@0: 'caller': caller, michael@0: 'supportfiles': '\n'.join(' %s' % f for f in sorted(support_files)), michael@0: 'tests': '\n'.join('[%s]' % f for f in sorted(test_files)) michael@0: }) michael@0: michael@0: michael@0: def substReftestList(caller, tests): michael@0: def reftests(tests): michael@0: return "\n".join(" ".join(line) for line in tests) michael@0: michael@0: return string.Template(reftest_template).substitute({ michael@0: "caller": caller, michael@0: "reftests": reftests(tests), michael@0: }) michael@0: