author arthur.iakab <>
Tue, 01 May 2018 01:39:08 +0300
changeset 472470 8ba36d8d99231b963a57c086550b4b371d2d9724
parent 457276 2d0766c3e7c94d7af3e40b8069aa8e3d6d4071aa
child 477168 602bdd9d5a96432300e7e8bd69bf608eb16ff952
permissions -rw-r--r--
Backed out 4 changesets (bug 1372381) for artifact build bustages Backed out changeset 56c7ffeaa9fd (bug 1372381) Backed out changeset 4e0f7fe818d0 (bug 1372381) Backed out changeset 92a96d6b599b (bug 1372381) Backed out changeset 620bdfafd42f (bug 1372381)

# 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

'''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()
    flags = set()
        if config.getint('XRE', 'EnableProfileMigrator') == 1:
    except Exception:
        if config.getint('Crash Reporter', 'Enabled') == 1:
    except Exception:
    appdata = dict(("%s:%s" % (s, o), config.get(s, o))
                   for s in config.sections() for o in config.options(s))
    appdata['flags'] = ' | '.join(flags) if flags else '0'
    appdata['App:profile'] = ('"%s"' % appdata['App:profile']
                              if 'App:profile' in appdata 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 not in appdata]
    if missing:
        print >>sys.stderr, \
            "Missing values in %s: %s" % (file, ', '.join(missing))

    if 'Crash Reporter:serverurl' not in appdata:
        appdata['Crash Reporter:serverurl'] = ''

    output.write('''#include "mozilla/XREAppData.h"
             static const mozilla::StaticXREAppData sAppData = {
                 NULL, // copyright
                 "%(Crash Reporter:serverurl)s",
             };''' % appdata)

if __name__ == '__main__':
    if len(sys.argv) != 1:
        main(sys.stdout, sys.argv[1])
        print >>sys.stderr, "Usage: %s /path/to/application.ini" % sys.argv[0]