当前位置: 首页>>代码示例>>Python>>正文


Python MachCommandConditions.is_android方法代码示例

本文整理汇总了Python中mozbuild.base.MachCommandConditions.is_android方法的典型用法代码示例。如果您正苦于以下问题:Python MachCommandConditions.is_android方法的具体用法?Python MachCommandConditions.is_android怎么用?Python MachCommandConditions.is_android使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mozbuild.base.MachCommandConditions的用法示例。


在下文中一共展示了MachCommandConditions.is_android方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run_xpcshell_test

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]
    def run_xpcshell_test(self, test_objects=None, **params):
        from mozbuild.controller.building import BuildDriver

        if test_objects is not None:
            from manifestparser import TestManifest
            m = TestManifest()
            m.tests.extend(test_objects)
            params['manifest'] = m

        driver = self._spawn(BuildDriver)
        driver.install_tests(test_objects)

        # We should probably have a utility function to ensure the tree is
        # ready to run tests. Until then, we just create the state dir (in
        # case the tree wasn't built with mach).
        self._ensure_state_subdir_exists('.')

        params['log'] = structured.commandline.setup_logging("XPCShellTests",
                                                             params,
                                                             {"mach": sys.stdout},
                                                             {"verbose": True})

        if conditions.is_android(self):
            from mozrunner.devices.android_device import verify_android_device
            verify_android_device(self)
            xpcshell = self._spawn(AndroidXPCShellRunner)
        else:
            xpcshell = self._spawn(XPCShellRunner)
        xpcshell.cwd = self._mach_context.cwd

        try:
            return xpcshell.run_test(**params)
        except InvalidTestPathError as e:
            print(e.message)
            return 1
开发者ID:lazyparser,项目名称:gecko-dev,代码行数:37,代码来源:mach_commands.py

示例2: run_xpcshell_test

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]
    def run_xpcshell_test(self, **params):
        from mozbuild.controller.building import BuildDriver

        # We should probably have a utility function to ensure the tree is
        # ready to run tests. Until then, we just create the state dir (in
        # case the tree wasn't built with mach).
        self._ensure_state_subdir_exists('.')

        driver = self._spawn(BuildDriver)
        driver.install_tests(remove=False)

        if conditions.is_android(self):
            xpcshell = self._spawn(AndroidXPCShellRunner)
        elif conditions.is_b2g(self):
            xpcshell = self._spawn(B2GXPCShellRunner)
            params['b2g_home'] = self.b2g_home
        else:
            xpcshell = self._spawn(XPCShellRunner)
        xpcshell.cwd = self._mach_context.cwd

        try:
            return xpcshell.run_test(**params)
        except InvalidTestPathError as e:
            print(e.message)
            return 1
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:27,代码来源:mach_commands.py

示例3: run_mochitest_chrome

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]
 def run_mochitest_chrome(self, test_paths, **kwargs):
     if conditions.is_firefox(self):
         return self.run_mochitest(test_paths, 'chrome', **kwargs)
     elif conditions.is_b2g(self) and conditions.is_emulator(self):
         return self.run_mochitest_remote(test_paths, chrome=True, **kwargs)
     elif conditions.is_android(self):
         return self.run_mochitest_android(test_paths, chrome=True, **kwargs)
开发者ID:LordJZ,项目名称:gecko-dev,代码行数:9,代码来源:mach_commands.py

示例4: run_xpcshell_test

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]
    def run_xpcshell_test(self, **params):
        from mozbuild.controller.building import BuildDriver

        # We should probably have a utility function to ensure the tree is
        # ready to run tests. Until then, we just create the state dir (in
        # case the tree wasn't built with mach).
        self._ensure_state_subdir_exists('.')

        driver = self._spawn(BuildDriver)
        driver.install_tests(remove=False)

        structured.commandline.formatter_option_defaults['verbose'] = True
        params['log'] = structured.commandline.setup_logging("XPCShellTests",
                                                             params,
                                                             {"mach": sys.stdout})

        if conditions.is_android(self):
            xpcshell = self._spawn(AndroidXPCShellRunner)
        elif conditions.is_b2g(self):
            xpcshell = self._spawn(B2GXPCShellRunner)
            params['b2g_home'] = self.b2g_home
            params['device_name'] = self.device_name
        else:
            xpcshell = self._spawn(XPCShellRunner)
        xpcshell.cwd = self._mach_context.cwd

        try:
            return xpcshell.run_test(**params)
        except InvalidTestPathError as e:
            print(e.message)
            return 1
开发者ID:html-shell,项目名称:mozbuild,代码行数:33,代码来源:mach_commands.py

示例5: __init__

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]
    def __init__(self, environment):
        if not MachCommandConditions.is_android(environment):
            raise Exception(
                'The Android Eclipse backend is not available with this '
                'configuration.')

        super(AndroidEclipseBackend, self).__init__(environment)
开发者ID:MekliCZ,项目名称:positron,代码行数:9,代码来源:android_eclipse.py

示例6: get_parser

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]
def get_parser():
    here = os.path.abspath(os.path.dirname(__file__))
    build_obj = MozbuildObject.from_environment(cwd=here)
    if conditions.is_android(build_obj):
        return reftestcommandline.RemoteArgumentsParser()
    else:
        return reftestcommandline.DesktopArgumentsParser()
开发者ID:psvramaraju,项目名称:gecko-dev,代码行数:9,代码来源:mach_commands.py

示例7: emulator

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]
    def emulator(self, version, wait=False, force_update=False, verbose=False):
        from mozrunner.devices.android_device import AndroidEmulator

        emulator = AndroidEmulator(version, verbose, substs=self.substs, device_serial='emulator-5554')
        if emulator.is_running():
            # It is possible to run multiple emulators simultaneously, but:
            #  - if more than one emulator is using the same avd, errors may
            #    occur due to locked resources;
            #  - additional parameters must be specified when running tests,
            #    to select a specific device.
            # To avoid these complications, allow just one emulator at a time.
            self.log(logging.ERROR, "emulator", {},
                     "An Android emulator is already running.\n"
                     "Close the existing emulator and re-run this command.")
            return 1

        if not emulator.is_available():
            self.log(logging.WARN, "emulator", {},
                     "Emulator binary not found.\n"
                     "Install the Android SDK and make sure 'emulator' is in your PATH.")
            return 2

        if not emulator.check_avd(force_update):
            self.log(logging.INFO, "emulator", {},
                     "Fetching and installing AVD. This may take a few minutes...")
            emulator.update_avd(force_update)

        self.log(logging.INFO, "emulator", {},
                 "Starting Android emulator running %s..." %
                 emulator.get_avd_description())
        emulator.start()
        if emulator.wait_for_start():
            self.log(logging.INFO, "emulator", {},
                     "Android emulator is running.")
        else:
            # This is unusual but the emulator may still function.
            self.log(logging.WARN, "emulator", {},
                     "Unable to verify that emulator is running.")

        if conditions.is_android(self):
            self.log(logging.INFO, "emulator", {},
                     "Use 'mach install' to install or update Firefox on your emulator.")
        else:
            self.log(logging.WARN, "emulator", {},
                     "No Firefox for Android build detected.\n"
                     "Switch to a Firefox for Android build context or use 'mach bootstrap'\n"
                     "to setup an Android build environment.")

        if wait:
            self.log(logging.INFO, "emulator", {},
                     "Waiting for Android emulator to close...")
            rc = emulator.wait()
            if rc is not None:
                self.log(logging.INFO, "emulator", {},
                         "Android emulator completed with return code %d." % rc)
            else:
                self.log(logging.WARN, "emulator", {},
                         "Unable to retrieve Android emulator return code.")
        return 0
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:61,代码来源:mach_commands.py

示例8: _run_reftest

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]
 def _run_reftest(self, **kwargs):
     process_test_objects(kwargs)
     reftest = self._spawn(ReftestRunner)
     if conditions.is_android(self):
         from mozrunner.devices.android_device import verify_android_device
         verify_android_device(self, install=True, xre=True)
         return reftest.run_android_test(**kwargs)
     return reftest.run_desktop_test(**kwargs)
开发者ID:weinrank,项目名称:gecko-dev,代码行数:10,代码来源:mach_commands.py

示例9: get_parser

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]
def get_parser():
    build_obj = MozbuildObject.from_environment(cwd=here)
    if conditions.is_android(build_obj):
        return parser_remote()
    elif conditions.is_b2g(build_obj):
        return parser_b2g()
    else:
        return parser_desktop()
开发者ID:npark-mozilla,项目名称:gecko-dev,代码行数:10,代码来源:mach_commands.py

示例10: run_mochitest_plain

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]
 def run_mochitest_plain(self, test_paths, **kwargs):
     if is_platform_in('firefox', 'mulet')(self):
         return self.run_mochitest(test_paths, 'plain', **kwargs)
     elif conditions.is_emulator(self):
         return self.run_mochitest_remote(test_paths, **kwargs)
     elif conditions.is_b2g_desktop(self):
         return self.run_mochitest_b2g_desktop(test_paths, **kwargs)
     elif conditions.is_android(self):
         return self.run_mochitest_android(test_paths, **kwargs)
开发者ID:LordJZ,项目名称:gecko-dev,代码行数:11,代码来源:mach_commands.py

示例11: __init__

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]
    def __init__(self, app=None, **kwargs):
        ArgumentParser.__init__(self, usage=self.__doc__, conflict_handler='resolve', **kwargs)

        self.oldcwd = os.getcwd()
        self.app = app
        if not self.app and build_obj:
            if conditions.is_android(build_obj):
                self.app = 'android'
            elif conditions.is_b2g(build_obj) or conditions.is_b2g_desktop(build_obj):
                self.app = 'b2g'
        if not self.app:
            # platform can't be determined and app wasn't specified explicitly,
            # so just use generic arguments and hope for the best
            self.app = 'generic'

        if self.app not in container_map:
            self.error("Unrecognized app '{}'! Must be one of: {}".format(
                self.app, ', '.join(container_map.keys())))

        defaults = {}
        for container in self.containers:
            defaults.update(container.defaults)
            group = self.add_argument_group(container.__class__.__name__, container.__doc__)

            for cli, kwargs in container.args:
                # Allocate new lists so references to original don't get mutated.
                # allowing multiple uses within a single process.
                if "default" in kwargs and isinstance(kwargs['default'], list):
                    kwargs["default"] = []

                if 'suppress' in kwargs:
                    if kwargs['suppress']:
                        kwargs['help'] = SUPPRESS
                    del kwargs['suppress']

                group.add_argument(*cli, **kwargs)

        self.set_defaults(**defaults)
        structured.commandline.add_logging_group(self)
开发者ID:nafis-sadik,项目名称:gecko-dev,代码行数:41,代码来源:mochitest_options.py

示例12: is_platform_supported

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]
def is_platform_supported(cls):
    """Must have a Firefox, Android or B2G build."""
    return conditions.is_android(cls) or \
           conditions.is_b2g(cls) or \
           conditions.is_firefox(cls)
开发者ID:chenhequn,项目名称:gecko,代码行数:7,代码来源:mach_commands.py

示例13: config_status

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]

#.........这里部分代码省略.........
    if 'CONFIG_FILES' in os.environ:
        raise Exception('Using the CONFIG_FILES environment variable is not '
            'supported.')
    if 'CONFIG_HEADERS' in os.environ:
        raise Exception('Using the CONFIG_HEADERS environment variable is not '
            'supported.')

    if not os.path.isabs(topsrcdir):
        raise Exception('topsrcdir must be defined as an absolute directory: '
            '%s' % topsrcdir)

    default_backends = ['RecursiveMake']
    default_backends = (substs or {}).get('BUILD_BACKENDS', ['RecursiveMake'])

    parser = ArgumentParser()
    parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
                        help='display verbose output')
    parser.add_argument('-n', dest='not_topobjdir', action='store_true',
                        help='do not consider current directory as top object directory')
    parser.add_argument('-d', '--diff', action='store_true',
                        help='print diffs of changed files.')
    parser.add_argument('-b', '--backend', nargs='+', choices=sorted(backends),
                        default=default_backends,
                        help='what backend to build (default: %s).' %
                        ' '.join(default_backends))
    parser.add_argument('--dry-run', action='store_true',
                        help='do everything except writing files out.')
    options = parser.parse_args()

    # Without -n, the current directory is meant to be the top object directory
    if not options.not_topobjdir:
        topobjdir = os.path.abspath('.')

    env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines,
            non_global_defines=non_global_defines, substs=substs,
            source=source, mozconfig=mozconfig)

    # mozinfo.json only needs written if configure changes and configure always
    # passes this environment variable.
    if 'WRITE_MOZINFO' in os.environ:
        write_mozinfo(os.path.join(topobjdir, 'mozinfo.json'), env, os.environ)

    cpu_start = time.clock()
    time_start = time.time()

    # Make appropriate backend instances, defaulting to RecursiveMakeBackend,
    # or what is in BUILD_BACKENDS.
    selected_backends = [get_backend_class(b)(env) for b in options.backend]

    if options.dry_run:
        for b in selected_backends:
            b.dry_run = True

    reader = BuildReader(env)
    emitter = TreeMetadataEmitter(env)
    # This won't actually do anything because of the magic of generators.
    definitions = emitter.emit(reader.read_topsrcdir())

    log_level = logging.DEBUG if options.verbose else logging.INFO
    log_manager.add_terminal_logging(level=log_level)
    log_manager.enable_unstructured()

    print('Reticulating splines...', file=sys.stderr)
    if len(selected_backends) > 1:
        definitions = list(definitions)

    for the_backend in selected_backends:
        the_backend.consume(definitions)

    execution_time = 0.0
    for obj in chain((reader, emitter), selected_backends):
        summary = obj.summary()
        print(summary, file=sys.stderr)
        execution_time += summary.execution_time

    cpu_time = time.clock() - cpu_start
    wall_time = time.time() - time_start
    efficiency = cpu_time / wall_time if wall_time else 100
    untracked = wall_time - execution_time

    print(
        'Total wall time: {:.2f}s; CPU time: {:.2f}s; Efficiency: '
        '{:.0%}; Untracked: {:.2f}s'.format(
            wall_time, cpu_time, efficiency, untracked),
        file=sys.stderr
    )

    if options.diff:
        for the_backend in selected_backends:
            for path, diff in sorted(the_backend.file_diffs.items()):
                print('\n'.join(diff))

    # Advertise Visual Studio if appropriate.
    if os.name == 'nt' and 'VisualStudio' not in options.backend:
        print(VISUAL_STUDIO_ADVERTISEMENT)

    # Advertise Eclipse if it is appropriate.
    if MachCommandConditions.is_android(env):
        if 'AndroidEclipse' not in options.backend:
            print(ANDROID_IDE_ADVERTISEMENT)
开发者ID:brendandahl,项目名称:positron,代码行数:104,代码来源:config_status.py

示例14: config_status

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]
def config_status(topobjdir=".", topsrcdir=".", defines=[], non_global_defines=[], substs=[], source=None):
    """Main function, providing config.status functionality.

    Contrary to config.status, it doesn't use CONFIG_FILES or CONFIG_HEADERS
    variables.

    Without the -n option, this program acts as config.status and considers
    the current directory as the top object directory, even when config.status
    is in a different directory. It will, however, treat the directory
    containing config.status as the top object directory with the -n option.

    The --recheck option, like with the original config.status, runs configure
    again, with the options given in the "ac_configure_args" subst.

    The options to this function are passed when creating the
    ConfigEnvironment. These lists, as well as the actual wrapper script
    around this function, are meant to be generated by configure.
    See build/autoconf/config.status.m4.
    """

    if "CONFIG_FILES" in os.environ:
        raise Exception("Using the CONFIG_FILES environment variable is not " "supported.")
    if "CONFIG_HEADERS" in os.environ:
        raise Exception("Using the CONFIG_HEADERS environment variable is not " "supported.")

    if not os.path.isabs(topsrcdir):
        raise Exception("topsrcdir must be defined as an absolute directory: " "%s" % topsrcdir)

    parser = OptionParser()
    parser.add_option(
        "--recheck",
        dest="recheck",
        action="store_true",
        help="update config.status by reconfiguring in the same conditions",
    )
    parser.add_option("-v", "--verbose", dest="verbose", action="store_true", help="display verbose output")
    parser.add_option(
        "-n",
        dest="not_topobjdir",
        action="store_true",
        help="do not consider current directory as top object directory",
    )
    parser.add_option("-d", "--diff", action="store_true", help="print diffs of changed files.")
    parser.add_option(
        "-b",
        "--backend",
        choices=["RecursiveMake", "AndroidEclipse", "CppEclipse", "VisualStudio", "Build", "ForceBuild"],
        default="Build",
        help="what backend to build (default: RecursiveMake).",
    )
    options, args = parser.parse_args()

    # Without -n, the current directory is meant to be the top object directory
    if not options.not_topobjdir:
        topobjdir = os.path.abspath(".")

    env = ConfigEnvironment(
        topsrcdir, topobjdir, defines=defines, non_global_defines=non_global_defines, substs=substs, source=source
    )

    # mozinfo.json only needs written if configure changes and configure always
    # passes this environment variable.
    if "WRITE_MOZINFO" in os.environ:
        write_mozinfo(os.path.join(topobjdir, "mozinfo.json"), env, os.environ)

    # Make an appropriate backend instance, defaulting to RecursiveMakeBackend.
    backend_cls = RecursiveMakeBackend
    if options.backend == "AndroidEclipse":
        from mozbuild.backend.android_eclipse import AndroidEclipseBackend

        if not MachCommandConditions.is_android(env):
            raise Exception("The Android Eclipse backend is not available with this configuration.")
        backend_cls = AndroidEclipseBackend
    elif options.backend == "CppEclipse":
        from mozbuild.backend.cpp_eclipse import CppEclipseBackend

        backend_cls = CppEclipseBackend
        if os.name == "nt":
            raise Exception("Eclipse is not supported on Windows. Consider using Visual Studio instead.")
    elif options.backend == "VisualStudio":
        from mozbuild.backend.visualstudio import VisualStudioBackend

        backend_cls = VisualStudioBackend
    elif options.backend == "Build":
        from mozbuild.backend.visualstudio import VisualStudioBackend

        backend_cls = VisualStudioBackend
    elif options.backend == "ForceBuild":
        from mozbuild.backend.visualstudio import VisualStudioBackend

        backend_cls = VisualStudioBackend

    the_backend = backend_cls(env)
    if options.backend == "Build":
        if the_backend.try_build():
            return
    elif options.backend == "ForceBuild":
        the_backend.full_build()

    reader = BuildReader(env)
#.........这里部分代码省略.........
开发者ID:html-shell,项目名称:mozbuild,代码行数:103,代码来源:config_status.py

示例15: is_firefox_or_android

# 需要导入模块: from mozbuild.base import MachCommandConditions [as 别名]
# 或者: from mozbuild.base.MachCommandConditions import is_android [as 别名]
def is_firefox_or_android(cls):
    """Must have Firefox build or Android build."""
    return conditions.is_firefox(cls) or conditions.is_android(cls)
开发者ID:lazyparser,项目名称:gecko-dev,代码行数:5,代码来源:mach_commands.py


注:本文中的mozbuild.base.MachCommandConditions.is_android方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。