def generate_build_for_target(pkg_cfg, target, deps, include_tests=True, include_dep_tests=False, default_loader=DEFAULT_LOADER): build = Bunch(# Contains section directories for all packages: packages=Bunch(), locale=Bunch() ) 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): # ensure that package name is valid try: validate_resource_hostname(cfg.name) except ValueError, err: print err sys.exit(1) # ensure that this package has an entry if not cfg.name in build.packages: build.packages[cfg.name] = Bunch() # detect duplicated sections if section in build.packages[cfg.name]: raise KeyError("package's section already defined", cfg.name, section) # Register this section (lib, data, tests) build.packages[cfg.name][section] = dirname
def build_config(root_dir, target_cfg): dirs_to_scan = [] def add_packages_from_config(pkgconfig): if 'packages' in pkgconfig: for package_dir in resolve_dirs(pkgconfig, pkgconfig.packages): dirs_to_scan.append(package_dir) add_packages_from_config(target_cfg) packages_dir = os.path.join(root_dir, 'packages') if os.path.exists(packages_dir) and os.path.isdir(packages_dir): dirs_to_scan.append(packages_dir) packages = Bunch({target_cfg.name: target_cfg}) while dirs_to_scan: packages_dir = dirs_to_scan.pop() package_paths = [ os.path.join(packages_dir, dirname) for dirname in os.listdir(packages_dir) if not dirname.startswith('.') ] for path in package_paths: pkgconfig = get_config_in_dir(path) if pkgconfig.name in packages: otherpkg = packages[pkgconfig.name] if not _is_same_file(otherpkg.root_dir, path): raise DuplicatePackageError(path, otherpkg.root_dir) else: packages[pkgconfig.name] = pkgconfig add_packages_from_config(pkgconfig) return Bunch(packages=packages)
def scan_requirements_with_grep(fn, lines): requires = Bunch() for line in lines: for clause in line.split(";"): clause = clause.strip() iscomment = False for commentprefix in COMMENT_PREFIXES: if clause.startswith(commentprefix): iscomment = True if iscomment: continue mo = re.search(REQUIRE_RE, clause) if mo: modname = mo.group(1) requires[modname] = Bunch() # define() can happen across multiple lines, so join everyone up. wholeshebang = "\n".join(lines) for match in DEF_RE.finditer(wholeshebang): # this should net us a list of string literals separated by commas for strbit in match.group(3).split(","): strbit = strbit.strip() # There could be a trailing comma netting us just whitespace, so # filter that out. Make sure that only string values with # quotes around them are allowed, and no quotes are inside # the quoted value. if strbit and DEF_RE_ALLOWED.match(strbit): modname = strbit[1:-1] requires[modname] = Bunch() return requires
def get_metadata(pkg_cfg, deps): metadata = Bunch() for pkg_name in deps: cfg = pkg_cfg.packages[pkg_name] metadata[pkg_name] = Bunch() for prop in METADATA_PROPS: if cfg.get(prop): metadata[pkg_name][prop] = cfg[prop] return metadata
def get_metadata(pkg_cfg, deps): metadata = Bunch() for pkg_name in deps: cfg = pkg_cfg.packages[pkg_name] metadata[pkg_name] = Bunch() for prop in METADATA_PROPS: if cfg.get(prop): if prop == 'permissions': validate_permissions(cfg[prop]) metadata[pkg_name][prop] = cfg[prop] return metadata
def get_config_in_dir(path): package_json = os.path.join(path, MANIFEST_NAME) if not (os.path.exists(package_json) and os.path.isfile(package_json)): raise MalformedPackageError('%s not found in "%s"' % (MANIFEST_NAME, path)) base_json = load_json_file(package_json) if 'name' not in base_json: base_json.name = os.path.basename(path) for dirname in ['lib', 'tests', 'data', 'packages']: apply_default_dir(base_json, path, dirname) for key in ['lib', 'tests', 'dependencies', 'packages']: normalize_string_or_array(base_json, key) if 'xpcom' in base_json: base_json.xpcom = Bunch(base_json.xpcom) if 'main' not in base_json and 'lib' in base_json: for dirname in base_json['lib']: program = os.path.join(path, dirname, '%s.js' % DEFAULT_PROGRAM_MODULE) if os.path.exists(program): base_json['main'] = DEFAULT_PROGRAM_MODULE break base_json.root_dir = path return base_json
def load_json_file(path): data = open(path, 'r').read() try: return Bunch(json.loads(data)) except ValueError, e: raise MalformedJsonFileError('%s when reading "%s"' % (str(e), path))
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): # ensure that package name is valid try: validate_resource_hostname(cfg.name) except ValueError, err: print err sys.exit(1) # ensure that this package has an entry if not cfg.name in build.packages: build.packages[cfg.name] = Bunch() # detect duplicated sections if section in build.packages[cfg.name]: raise KeyError("package's section already defined", cfg.name, section) # Register this section (lib, data, tests) build.packages[cfg.name][section] = dirname
def add_locale_to_build(cfg): # Bug 730776: Ignore locales for addon-kit, that are only for unit tests if not is_running_tests and cfg.name == "addon-sdk": return path = resolve_dir(cfg, cfg['locale']) files = os.listdir(path) for filename in files: fullpath = os.path.join(path, filename) if os.path.isfile(fullpath) and filename.endswith('.properties'): language = filename[:-len('.properties')] from property_parser import parse_file, MalformedLocaleFileError try: content = parse_file(fullpath) except MalformedLocaleFileError, msg: print msg[0] sys.exit(1) # Merge current locales into global locale hashtable. # Locale files only contains one big JSON object # that act as an hastable of: # "keys to translate" => "translated keys" if language in build.locale: merge = (build.locale[language].items() + content.items()) build.locale[language] = Bunch(merge) else: build.locale[language] = content
def call_cmdline_tool(env_root, pkg_name): pkg_cfg = build_config(env_root, Bunch(name='dummy')) if pkg_name not in pkg_cfg.packages: print "This tool requires the '%s' package." % pkg_name sys.exit(1) cfg = pkg_cfg.packages[pkg_name] for dirname in resolve_dirs(cfg, cfg['python-lib']): sys.path.append(dirname) module_name = cfg.get('python-cmdline-tool') module = __import__(module_name) module.run()
def test_all_packages(env_root, defaults): deps = [] target_cfg = Bunch(name="testpkgs", dependencies=deps) pkg_cfg = packaging.build_config(env_root, target_cfg) for name in pkg_cfg.packages: if name != "testpkgs": deps.append(name) print "Testing all available packages: %s." % (", ".join(deps)) run(arguments=["test", "--dep-tests"], target_cfg=target_cfg, pkg_cfg=pkg_cfg, defaults=defaults)
def get_configs(pkg_name): pkg_path = os.path.join(static_files_path, 'packages', pkg_name) if not (os.path.exists(pkg_path) and os.path.isdir(pkg_path)): raise Exception('path does not exist: %s' % pkg_path) target_cfg = packaging.get_config_in_dir(pkg_path) pkg_cfg = packaging.build_config(static_files_path, target_cfg) deps = packaging.get_deps_for_targets(pkg_cfg, [pkg_name]) build = packaging.generate_build_for_target(pkg_cfg=pkg_cfg, target=pkg_name, deps=deps, prefix='guid-') return Bunch(target_cfg=target_cfg, pkg_cfg=pkg_cfg, build=build)
def get_configs(pkg_name, dirname='static-files'): root_path = os.path.join(tests_path, dirname) pkg_path = os.path.join(root_path, 'packages', pkg_name) if not (os.path.exists(pkg_path) and os.path.isdir(pkg_path)): raise Exception('path does not exist: %s' % pkg_path) target_cfg = packaging.get_config_in_dir(pkg_path) pkg_cfg = packaging.build_config(root_path, target_cfg) deps = packaging.get_deps_for_targets(pkg_cfg, [pkg_name]) build = packaging.generate_build_for_target( pkg_cfg=pkg_cfg, target=pkg_name, deps=deps, is_running_tests=True, ) return Bunch(target_cfg=target_cfg, pkg_cfg=pkg_cfg, build=build)
def scan_package(prefix, resource_url, pkg_name, section, dirname, stderr=sys.stderr): manifest = {} has_problems = False for dirpath, dirnames, filenames in os.walk(dirname): for fn in [fn for fn in filenames if fn.endswith(".js")]: modname = os.path.splitext(fn)[0] # turn "packages/api-utils/lib/content/foo" into "content/foo" reldir = dirpath[len(dirname) + 1:] if reldir: modname = "/".join(reldir.split(os.sep) + [modname]) absfn = os.path.join(dirpath, fn) hashhex = hashlib.sha256(open(absfn, "rb").read()).hexdigest() lines = open(absfn).readlines() requires, chrome, problems = scan_module(absfn, lines, stderr) url = "%s%s.js" % (resource_url, modname) info = { "packageName": pkg_name, "sectionName": section, "name": modname, "hash": hashhex, "requires": requires, "chrome": chrome, "e10s-adapter": None, "zipname": "resources/%s%s-%s/%s.js" % (prefix, pkg_name, section, modname), } manifest[url] = Bunch(**info) if problems: has_problems = True return manifest, has_problems
def add_locale_to_build(cfg): path = resolve_dir(cfg, cfg['locale']) files = os.listdir(path) for filename in files: fullpath = os.path.join(path, filename) if os.path.isfile(fullpath) and filename.endswith('.properties'): language = filename[:-len('.properties')] from property_parser import parse_file content = parse_file(fullpath) # Merge current locales into global locale hashtable. # Locale files only contains one big JSON object # that act as an hastable of: # "keys to translate" => "translated keys" if language in build.locale: merge = (build.locale[language].items() + content.items()) build.locale[language] = Bunch(merge) else: build.locale[language] = content
def generate_build_for_target(pkg_cfg, target, deps, prefix='', include_tests=True, include_dep_tests=False, default_loader=DEFAULT_LOADER): validate_resource_hostname(prefix) manifest = {} build = Bunch( resources=Bunch(), resourcePackages=Bunch(), packageData=Bunch(), rootPaths=[], manifest=manifest, ) 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 def add_dep_to_build(dep): dep_cfg = pkg_cfg.packages[dep] add_section_to_build(dep_cfg, "lib", is_code=True) add_section_to_build(dep_cfg, "data", is_data=True) if include_tests and include_dep_tests: add_section_to_build(dep_cfg, "tests", is_code=True) if ("loader" in dep_cfg) and ("loader" not in build): build.loader = "resource://%s-%s" % (prefix + dep, dep_cfg.loader) target_cfg = pkg_cfg.packages[target] if include_tests and not include_dep_tests: add_section_to_build(target_cfg, "tests", is_code=True) for dep in deps: add_dep_to_build(dep) if 'loader' not in build: add_dep_to_build(DEFAULT_LOADER) if 'icon' in target_cfg: build['icon'] = os.path.join(target_cfg.root_dir, target_cfg.icon) del target_cfg['icon'] if 'icon64' in target_cfg: build['icon64'] = os.path.join(target_cfg.root_dir, target_cfg.icon64) del target_cfg['icon64'] # now go back through and find out where each module lives, to record the # pathname in the manifest update_manifest_with_fileinfo(deps, DEFAULT_LOADER, manifest) return build
def build_pkg_cfg(root): pkg_cfg = build_config(root, Bunch(name='dummy')) del pkg_cfg.packages['dummy'] return pkg_cfg
def build_xpcom_components(comp_src_dir, moz_srcdir, moz_objdir, base_output_dir, module_name, xpt_output_dir=None): options = Bunch(srcdir=moz_srcdir, objdir=moz_objdir) xpcom_info = Bunch() autoconf = open(os.path.join(options.objdir, "config", "autoconf.mk"), "r").readlines() for line in autoconf: if line.startswith("OS_TARGET"): xpcom_info.os = line.split("=")[1].strip() elif line.startswith("LIBXUL_SDK"): xpcom_info.libxul = line.split("=")[1].strip() if sys.platform.startswith('win'): # The path is mingw-style, convert it to windows-style. sh_echo = subprocess.Popen(["sh", "-c", "cmd //c echo " + xpcom_info.libxul], stdout=subprocess.PIPE) sh_echo.wait() xpcom_info.libxul = sh_echo.stdout.read().strip() elif line.startswith("TARGET_XPCOM_ABI"): xpcom_info.abi = line.split("=")[1].strip() elif line.startswith("MOZILLA_VERSION"): xpcom_info.mozilla_version = line.split("=")[1].strip()[:5] elif (line.startswith("MOZ_DEBUG") and not line.startswith("MOZ_DEBUG_")): raw_value = line.split("=")[1].strip() if not raw_value: xpcom_info.is_debug = 0 else: xpcom_info.is_debug = int(raw_value) platform = "%(os)s_%(abi)s" % xpcom_info print "Building XPCOM binary components for %s" % platform rel_dest_dir = os.path.join("browser", "components", module_name) comp_dest_dir = os.path.join(options.srcdir, rel_dest_dir) comp_xpi_dir = os.path.join(options.objdir, "dist", "xpi-stage", module_name, "components") comp_plat_dir = os.path.join(base_output_dir, platform, xpcom_info.mozilla_version) clear_dir(comp_dest_dir) clear_dir(comp_xpi_dir) shutil.copytree(comp_src_dir, comp_dest_dir) # Ensure that these paths are unix-like on Windows. sh_pwd = subprocess.Popen(["sh", "-c", "pwd"], cwd=options.srcdir, stdout=subprocess.PIPE) sh_pwd.wait() unix_topsrcdir = sh_pwd.stdout.read().strip() unix_rel_dest_dir = rel_dest_dir.replace("\\", "/") # We're specifying 'perl' here because we have to for this # to work on Windows. run_program(["perl", os.path.join(options.srcdir, "build", "autoconf", "make-makefile"), "-t", unix_topsrcdir, unix_rel_dest_dir], cwd=options.objdir) env = {} env.update(os.environ) run_program(["make"], cwd=os.path.join(options.objdir, rel_dest_dir), env=env) xptfiles = [] libfiles = [] for filename in os.listdir(comp_xpi_dir): if fnmatch.fnmatch(filename, '*.xpt'): xptfiles.append(filename) else: libfiles.append(filename) clear_dir(comp_plat_dir) distutils.dir_util.mkpath(comp_plat_dir) for filename in libfiles: shutil.copy(os.path.join(comp_xpi_dir, filename), comp_plat_dir) if xptfiles and not xpt_output_dir: raise ValueError('typelibs generated, but xpt_output_dir ' 'not provided') for filename in xptfiles: shutil.copy(os.path.join(comp_xpi_dir, filename), xpt_output_dir) clear_dir(comp_dest_dir) clear_dir(comp_xpi_dir)
def generate_build_for_target(pkg_cfg, target, deps, prefix='', include_tests=True, include_dep_tests=False, default_loader=DEFAULT_LOADER): validate_resource_hostname(prefix) manifest = [] build = Bunch( resources=Bunch(), resourcePackages=Bunch(), packageData=Bunch(), rootPaths=[], manifest=manifest, ) 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) if is_data: build.packageData[cfg.name] = resource_url if section == "lib": 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) def add_dep_to_build(dep): dep_cfg = pkg_cfg.packages[dep] add_section_to_build(dep_cfg, "lib", is_code=True) add_section_to_build(dep_cfg, "data", is_data=True) if include_tests and include_dep_tests: add_section_to_build(dep_cfg, "tests", is_code=True) if "loader" in dep_cfg: build.loader = "resource://%s-%s" % (prefix + dep, dep_cfg.loader) target_cfg = pkg_cfg.packages[target] if include_tests and not include_dep_tests: add_section_to_build(target_cfg, "tests", is_code=True) for dep in deps: add_dep_to_build(dep) if 'loader' not in build: add_dep_to_build(DEFAULT_LOADER) return build
def build_xpcom_components(comp_src_dir, moz_srcdir, moz_objdir, base_output_dir, module_name, xpt_output_dir=None): options = Bunch(srcdir=moz_srcdir, objdir=moz_objdir) xpcom_info = Bunch() autoconf = open(os.path.join(options.objdir, "config", "autoconf.mk"), "r").readlines() for line in autoconf: if line.startswith("OS_TARGET"): xpcom_info.os = line.split("=")[1].strip() elif line.startswith("LIBXUL_SDK"): xpcom_info.libxul = line.split("=")[1].strip() if sys.platform.startswith('win'): # The path is mingw-style, convert it to windows-style. sh_echo = subprocess.Popen( ["sh", "-c", "cmd //c echo " + xpcom_info.libxul], stdout=subprocess.PIPE) sh_echo.wait() xpcom_info.libxul = sh_echo.stdout.read().strip() elif line.startswith("TARGET_XPCOM_ABI"): xpcom_info.abi = line.split("=")[1].strip() elif line.startswith("MOZILLA_VERSION"): xpcom_info.mozilla_version = line.split("=")[1].strip()[:5] elif (line.startswith("MOZ_DEBUG") and not line.startswith("MOZ_DEBUG_")): raw_value = line.split("=")[1].strip() if not raw_value: xpcom_info.is_debug = 0 else: xpcom_info.is_debug = int(raw_value) platform = "%(os)s_%(abi)s" % xpcom_info print "Building XPCOM binary components for %s" % platform rel_dest_dir = os.path.join("browser", "components", module_name) comp_dest_dir = os.path.join(options.srcdir, rel_dest_dir) comp_xpi_dir = os.path.join(options.objdir, "dist", "xpi-stage", module_name, "components") comp_plat_dir = os.path.join(base_output_dir, platform, xpcom_info.mozilla_version) clear_dir(comp_dest_dir) clear_dir(comp_xpi_dir) shutil.copytree(comp_src_dir, comp_dest_dir) # Ensure that these paths are unix-like on Windows. sh_pwd = subprocess.Popen(["sh", "-c", "pwd"], cwd=options.srcdir, stdout=subprocess.PIPE) sh_pwd.wait() unix_topsrcdir = sh_pwd.stdout.read().strip() unix_rel_dest_dir = rel_dest_dir.replace("\\", "/") # We're specifying 'perl' here because we have to for this # to work on Windows. run_program([ "perl", os.path.join(options.srcdir, "build", "autoconf", "make-makefile"), "-t", unix_topsrcdir, unix_rel_dest_dir ], cwd=options.objdir) env = {} env.update(os.environ) run_program(["make"], cwd=os.path.join(options.objdir, rel_dest_dir), env=env) xptfiles = [] libfiles = [] for filename in os.listdir(comp_xpi_dir): if fnmatch.fnmatch(filename, '*.xpt'): xptfiles.append(filename) else: libfiles.append(filename) clear_dir(comp_plat_dir) distutils.dir_util.mkpath(comp_plat_dir) for filename in libfiles: shutil.copy(os.path.join(comp_xpi_dir, filename), comp_plat_dir) if xptfiles and not xpt_output_dir: raise ValueError('typelibs generated, but xpt_output_dir ' 'not provided') for filename in xptfiles: shutil.copy(os.path.join(comp_xpi_dir, filename), xpt_output_dir) clear_dir(comp_dest_dir) clear_dir(comp_xpi_dir)
parser_groups = Bunch( xpi=Bunch(name="XPI Options", options={ ( "-u", "--update-url", ): dict(dest="update_url", help="update URL in install.rdf", metavar=None, default=None), ( "-l", "--update-link", ): dict(dest="update_link", help="generate update.rdf", metavar=None, default=None), }), app=Bunch(name="Application Options", options={ ( "-P", "--profiledir", ): dict(dest="profiledir", help=("profile directory to " "pass to app"), metavar=None, default=None), ( "-b", "--binary", ): dict(dest="binary", help="path to app binary", metavar=None, default=None), ( "", "--addons", ): dict(dest="addons", help=("paths of addons to install, " "comma-separated"), metavar=None, default=None), ( "-a", "--app", ): dict(dest="app", help=("app to run: " "firefox (default), xulrunner, " "fennec, or thunderbird"), metavar=None, default="firefox"), ( "-f", "--logfile", ): dict(dest="logfile", help="log console output to file", metavar=None, default=None), ( "-r", "--use-server", ): dict(dest="use_server", help="use development server", action="store_true", default=False), }), xpcom=Bunch(name="XPCOM Compilation Options", options={ ( "-s", "--srcdir", ): dict(dest="moz_srcdir", help="Mozilla source dir", metavar=None, default=None), ( "-o", "--objdir", ): dict(dest="moz_objdir", help="Mozilla objdir", metavar=None, default=None), }), tests=Bunch( name="Testing Options", options={ ( "", "--test-runner-pkg", ): dict(dest="test_runner_pkg", help=("name of package " "containing test runner " "program (default is " "test-harness)"), default="test-harness"), ( "-d", "--dep-tests", ): dict(dest="dep_tests", help="include tests for all deps", action="store_true", default=False), ( "-x", "--times", ): dict(dest="iterations", type="int", help="number of times to run tests", default=1), ( "-F", "--filter", ): dict(dest="filter", help="only run tests that match regexp", metavar=None, default=None), # TODO: This should default to true once our memory debugging # issues are resolved; see bug 592774. ( "-m", "--profile-memory", ): dict(dest="profileMemory", help=("profile memory usage " "(default is false)"), type="int", action="store", default=0) }), )
def generate_build_for_target(pkg_cfg, target, deps, prefix='', include_tests=True, include_dep_tests=False, default_loader=DEFAULT_LOADER): validate_resource_hostname(prefix) build = Bunch(resources=Bunch(), resourcePackages=Bunch(), packageData=Bunch(), rootPaths=[], ) 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) name = "-".join([prefix + cfg.name, section]) 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) if is_data: build.packageData[cfg.name] = resource_url def add_dep_to_build(dep): dep_cfg = pkg_cfg.packages[dep] add_section_to_build(dep_cfg, "lib", is_code=True) add_section_to_build(dep_cfg, "data", is_data=True) if include_tests and include_dep_tests: add_section_to_build(dep_cfg, "tests", is_code=True) if ("loader" in dep_cfg) and ("loader" not in build): build.loader = "resource://%s-%s" % (prefix + dep, dep_cfg.loader) target_cfg = pkg_cfg.packages[target] if include_tests and not include_dep_tests: add_section_to_build(target_cfg, "tests", is_code=True) for dep in deps: add_dep_to_build(dep) if 'loader' not in build: add_dep_to_build(DEFAULT_LOADER) if 'icon' in target_cfg: build['icon'] = os.path.join(target_cfg.root_dir, target_cfg.icon) del target_cfg['icon'] if 'icon64' in target_cfg: build['icon64'] = os.path.join(target_cfg.root_dir, target_cfg.icon64) del target_cfg['icon64'] return build
parser_groups = Bunch( xpi=Bunch(name="XPI Options", options={ ( "-u", "--update-url", ): dict(dest="update_url", help="update URL in install.rdf", metavar=None, default=None), ( "-l", "--update-link", ): dict(dest="update_link", help="generate update.rdf", metavar=None, default=None), }), app=Bunch(name="Application Options", options={ ( "-P", "--profiledir", ): dict(dest="profiledir", help=("profile directory to " "pass to app"), metavar=None, default=None), ( "-b", "--binary", ): dict(dest="binary", help="path to app binary", metavar=None, default=None), ( "", "--addons", ): dict(dest="addons", help=("paths of addons to install, " "comma-separated"), metavar=None, default=None), ( "-a", "--app", ): dict(dest="app", help=("app to run: " "firefox (default), xulrunner, " "fennec, or thunderbird"), metavar=None, default="firefox"), ( "-f", "--logfile", ): dict(dest="logfile", help="log console output to file", metavar=None, default=None), ( "-r", "--use-server", ): dict(dest="use_server", help="use development server", action="store_true", default=False), }), xpcom=Bunch(name="XPCOM Compilation Options", options={ ( "-s", "--srcdir", ): dict(dest="moz_srcdir", help="Mozilla source dir", metavar=None, default=None), ( "-o", "--objdir", ): dict(dest="moz_objdir", help="Mozilla objdir", metavar=None, default=None), }), tests=Bunch(name="Testing Options", options={ ( "-d", "--dep-tests", ): dict(dest="dep_tests", help="include tests for all deps", action="store_true", default=False), ( "-x", "--times", ): dict(dest="iterations", type="int", help="number of times to run tests", default=1), ( "-F", "--filter", ): dict(dest="filter", help="only run tests that match regexp", metavar=None, default=None), }), )