# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""Parses a given application.ini file and outputs the corresponding
StaticXREAppData structure as a C++ header file"""
import configparser import sys
def main(output, file):
config = configparser.RawConfigParser()
config.read(file)
flags = set() try: if config.getint("XRE", "EnableProfileMigrator") == 1:
flags.add("NS_XRE_ENABLE_PROFILE_MIGRATOR") except Exception: pass try: if config.getint("Crash Reporter", "Enabled") == 1:
flags.add("NS_XRE_ENABLE_CRASH_REPORTER") except Exception: pass
appdata = dict(
("%s:%s" % (s, o), config.get(s, o)) for s in config.sections() for o in config.options(s)
)
appdata["flags"] = " | ".join(sorted(flags)) if flags else"0" for key in ("App:vendor", "App:profile"): # Set to NULL when not present or falsy such as an empty string
appdata[key] = '"%s"' % appdata[key] if appdata.get(key, None) else"NULL"
expected = ( "App:vendor", "App:name", "App:remotingname", "App:version", "App:buildid", "App:id", "Gecko:minversion", "Gecko:maxversion",
)
missing = [var for var in expected if var notin appdata] if missing:
print("Missing values in %s: %s" % (file, ", ".join(missing)), file=sys.stderr)
sys.exit(1)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.