Example #1
0
    def add_section_to_build(cfg, section, is_code=False,
                             is_data=False):
        if section in cfg:
            dirnames = cfg[section]
            if isinstance(dirnames, basestring):
                # This is just for internal consistency within this
                # function, it has nothing to do w/ a non-canonical
                # configuration dict.
                dirnames = [dirnames]
            for dirname in resolve_dirs(cfg, dirnames):
                name = "-".join([prefix + cfg.name,
                                 os.path.basename(dirname)])
                validate_resource_hostname(name)
                if name in build.resources:
                    raise KeyError('resource already defined', name)
                build.resourcePackages[name] = cfg.name
                build.resources[name] = dirname
                resource_url = 'resource://%s/' % name

                if is_code:
                    build.rootPaths.insert(0, resource_url)
                    from manifest import scan_package
                    pkg_manifest, problems = scan_package(cfg.name, dirname)
                    if problems:
                        # the relevant instructions have already been written
                        # to stderr
                        raise BadChromeMarkerError()
                    manifest.extend(pkg_manifest)

                if is_data:
                    build.packageData[cfg.name] = resource_url
Example #2
0
    def add_section_to_build(cfg, section, is_code=False, is_data=False):
        if section in cfg:
            dirnames = cfg[section]
            if isinstance(dirnames, basestring):
                # This is just for internal consistency within this
                # function, it has nothing to do w/ a non-canonical
                # configuration dict.
                dirnames = [dirnames]
            for dirname in resolve_dirs(cfg, dirnames):
                lib_base = os.path.basename(dirname)
                if lib_base == '.':
                    lib_base = 'root'
                name = "-".join([prefix + cfg.name, lib_base])
                validate_resource_hostname(name)
                if name in build.resources:
                    raise KeyError('resource already defined', name)
                build.resourcePackages[name] = cfg.name
                build.resources[name] = dirname
                resource_url = 'resource://%s/' % name

                if is_code:
                    build.rootPaths.insert(0, resource_url)
                    pkg_manifest, problems = scan_package(
                        prefix, resource_url, cfg.name, section, dirname)
                    if problems:
                        # the relevant instructions have already been written
                        # to stderr
                        raise BadChromeMarkerError()
                    manifest.update(pkg_manifest)

                if is_data:
                    build.packageData[cfg.name] = resource_url