Bug 1750871 - run mochitest-remote on fission everywhere. r=releng-reviewers,aki
[gecko.git] / toolkit / library / gen_buildid.py
blob2638d9ffc5fb6318c0dd6342b5fd5847201cc5c0
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 file,
3 # You can obtain one at http://mozilla.org/MPL/2.0/.
5 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
6 # vim: set filetype=python:
7 # This Source Code Form is subject to the terms of the Mozilla Public
8 # License, v. 2.0. If a copy of the MPL was not distibuted with this
9 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 from mozbuild.preprocessor import Preprocessor
13 from io import StringIO
14 import buildconfig
15 import os
18 def main(output, input_file):
19 with open(input_file) as fh:
20 if buildconfig.substs["EXPAND_LIBS_LIST_STYLE"] == "linkerscript":
22 def cleanup(line):
23 assert line.startswith('INPUT("')
24 assert line.endswith('")')
25 return line[len('INPUT("') : -len('")')]
27 objs = [cleanup(l.strip()) for l in fh.readlines()]
28 else:
29 objs = [l.strip() for l in fh.readlines()]
31 pp = Preprocessor()
32 pp.out = StringIO()
33 pp.do_include(os.path.join(buildconfig.topobjdir, "buildid.h"))
34 buildid = pp.context["MOZ_BUILDID"]
35 output.write('extern const char gToolkitBuildID[] = "%s";' % buildid)
36 return set(
37 os.path.join("build", o)
38 for o in objs
39 if os.path.splitext(os.path.basename(o))[0] != "buildid"