Esempio n. 1
0
def read_conf(conf_filename):
    # Invoking the preprocessor ourselves is easier than writing build rules
    # to do it for us.
    processed = StringIO.StringIO()
    preprocess(includes=[conf_filename], defines=buildconfig.defines, output=processed)

    # Can't read/write from a single StringIO, so make a new one for reading.
    stream = StringIO.StringIO(processed.getvalue())

    def parse_counters(stream):
        for line_num, line in enumerate(stream):
            line = line.rstrip("\n")
            if not line or line.startswith("//"):
                # empty line or comment
                continue
            m = re.match(r"method ([A-Za-z0-9]+)\.([A-Za-z0-9]+)$", line)
            if m:
                interface_name, method_name = m.groups()
                yield {"type": "method", "interface_name": interface_name, "method_name": method_name}
                continue
            m = re.match(r"attribute ([A-Za-z0-9]+)\.([A-Za-z0-9]+)$", line)
            if m:
                interface_name, attribute_name = m.groups()
                yield {"type": "attribute", "interface_name": interface_name, "attribute_name": attribute_name}
                continue
            m = re.match(r"property ([a-z0-9-]+)$", line)
            if m:
                property_name = m.group(1)
                yield {"type": "property", "property_name": property_name}
                continue
            raise ValueError("error parsing %s at line %d" % (conf_filename, line_num))

    return parse_counters(stream)
Esempio n. 2
0
def generate_android_manifest(output_file, input_filename):
    includes = preprocessor.preprocess(includes=[input_filename],
                                       defines=_defines(),
                                       output=output_file,
                                       marker='#')
    includes.add(os.path.join(buildconfig.topobjdir, 'buildid.h'))
    return includes
def generate_android_manifest(output_file, input_filename):
    includes = preprocessor.preprocess(includes=[input_filename],
                                       defines=_defines(),
                                       output=output_file,
                                       marker='#')
    includes.add(os.path.join(buildconfig.topobjdir, 'buildid.h'))
    return includes
Esempio n. 4
0
def main(output, bookmarks_html_in, bookmarks_inc, locale=None):
    if not locale:
        raise ValueError('locale must be specified!')

    CONFIG = buildconfig.substs

    # Based on
    # https://dxr.mozilla.org/l10n-central/search?q=path%3Abookmarks.inc+%23if&redirect=true,
    # no localized input uses the preprocessor conditional #if (really,
    # anything but #define), so it's safe to restrict the set of defines to
    # what's used in mozilla-central directly.
    defines = {}
    defines['AB_CD'] = locale
    if defines['AB_CD'] == 'ja-JP-mac':
        defines['AB_CD'] = 'ja'

    defines['BOOKMARKS_INCLUDE_PATH'] = bookmarks_inc

    for var in ('NIGHTLY_BUILD', ):
        if var in CONFIG:
            defines[var] = CONFIG[var]

    includes = preprocessor.preprocess(includes=[bookmarks_html_in],
                                       defines=defines,
                                       output=output)
    return includes
Esempio n. 5
0
def main(output,
         strings_xml,
         android_strings_dtd,
         sync_strings_dtd,
         locale=None):
    if not locale:
        raise ValueError('locale must be specified!')

    CONFIG = buildconfig.substs

    defines = {}
    defines['ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME']
    defines['MOZ_APP_DISPLAYNAME'] = CONFIG['MOZ_APP_DISPLAYNAME']
    # Includes.
    defines['STRINGSPATH'] = android_strings_dtd
    defines['SYNCSTRINGSPATH'] = sync_strings_dtd
    # Fennec branding is en-US only: see
    # $(MOZ_BRANDING_DIRECTORY)/locales/jar.mn.
    defines['BRANDPATH'] = '{}/{}/locales/en-US/brand.dtd'.format(
        buildconfig.topsrcdir, CONFIG['MOZ_BRANDING_DIRECTORY'])

    includes = preprocessor.preprocess(includes=[strings_xml],
                                       defines=defines,
                                       output=output)
    return includes
Esempio n. 6
0
def main(output, bookmarks_html_in, bookmarks_inc, locale=None):
    if not locale:
        raise ValueError('locale must be specified!')

    CONFIG = buildconfig.substs

    # Based on
    # https://dxr.mozilla.org/l10n-central/search?q=path%3Abookmarks.inc+%23if&redirect=true,
    # no localized input uses the preprocessor conditional #if (really,
    # anything but #define), so it's safe to restrict the set of defines to
    # what's used in mozilla-central directly.
    defines = {}
    defines['AB_CD'] = locale
    if defines['AB_CD'] == 'ja-JP-mac':
        defines['AB_CD'] = 'ja'

    defines['BOOKMARKS_INCLUDE_PATH'] = bookmarks_inc

    for var in ('NIGHTLY_BUILD',):
        if var in CONFIG:
            defines[var] = CONFIG[var]

    includes = preprocessor.preprocess(includes=[bookmarks_html_in],
                                       defines=defines,
                                       output=output)
    return includes
Esempio n. 7
0
def read_conf(conf_filename):
    # Invoking the preprocessor ourselves is easier than writing build rules
    # to do it for us.
    processed = StringIO.StringIO()
    preprocess(includes=[conf_filename],
               defines=buildconfig.defines,
               output=processed)

    # Can't read/write from a single StringIO, so make a new one for reading.
    stream = StringIO.StringIO(processed.getvalue())

    def parse_counters(stream):
        for line_num, line in enumerate(stream):
            line = line.rstrip('\n')
            if not line or line.startswith('//'):
                # empty line or comment
                continue
            m = re.match(r'method ([A-Za-z0-9]+)\.([A-Za-z0-9]+)$', line)
            if m:
                interface_name, method_name = m.groups()
                yield {
                    'type': 'method',
                    'interface_name': interface_name,
                    'method_name': method_name
                }
                continue
            m = re.match(r'attribute ([A-Za-z0-9]+)\.([A-Za-z0-9]+)$', line)
            if m:
                interface_name, attribute_name = m.groups()
                yield {
                    'type': 'attribute',
                    'interface_name': interface_name,
                    'attribute_name': attribute_name
                }
                continue
            m = re.match(r'property ([A-Za-z0-9]+)$', line)
            if m:
                property_name = m.group(1)
                yield {'type': 'property', 'property_name': property_name}
                continue
            raise ValueError('error parsing %s at line %d' %
                             (conf_filename, line_num))

    return parse_counters(stream)
Esempio n. 8
0
def read_conf(conf_filename):
    # Invoking the preprocessor ourselves is easier than writing build rules
    # to do it for us.
    processed = StringIO.StringIO()
    preprocess(includes=[conf_filename],
               defines=buildconfig.defines,
               output=processed)

    # Can't read/write from a single StringIO, so make a new one for reading.
    stream = StringIO.StringIO(processed.getvalue())

    def parse_counters(stream):
        for line_num, line in enumerate(stream):
            line = line.rstrip('\n')
            if not line or line.startswith('//'):
                # empty line or comment
                continue
            m = re.match(r'method ([A-Za-z0-9]+)\.([A-Za-z0-9]+)$', line)
            if m:
                interface_name, method_name = m.groups()
                yield { 'type': 'method',
                        'interface_name': interface_name,
                        'method_name': method_name }
                continue
            m = re.match(r'attribute ([A-Za-z0-9]+)\.([A-Za-z0-9]+)$', line)
            if m:
                interface_name, attribute_name = m.groups()
                yield { 'type': 'attribute',
                        'interface_name': interface_name,
                        'attribute_name': attribute_name }
                continue
            m = re.match(r'property ([A-Za-z0-9]+)$', line)
            if m:
                property_name = m.group(1)
                yield { 'type': 'property',
                        'property_name': property_name }
                continue
            raise ValueError('error parsing %s at line %d' % (conf_filename, line_num))

    return parse_counters(stream)
Esempio n. 9
0
def _do_preprocessing(output_svg, input_svg_file, additional_defines):
    additional_defines.update(buildconfig.defines)
    preprocess(output=output_svg,
               includes=[input_svg_file],
               marker='%',
               defines=additional_defines)
Esempio n. 10
0
def _do_preprocessing(output_svg, input_svg_file, additional_defines):
    additional_defines.update(buildconfig.defines)
    return preprocess(output=output_svg,
                      includes=[input_svg_file],
                      marker='%',
                      defines=additional_defines)