• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python command_base.cd函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中servo.command_base.cd函数的典型用法代码示例。如果您正苦于以下问题:Python cd函数的具体用法?Python cd怎么用?Python cd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: build

    def build(self, target=None, release=False, jobs=None, android=None,
              verbose=False, debug_mozjs=False, params=None):
        self.ensure_bootstrapped()

        if android is None:
            android = self.config["build"]["android"]

        opts = params or []
        features = []

        if release:
            opts += ["--release"]
        if target:
            opts += ["--target", target]
        if jobs is not None:
            opts += ["-j", jobs]
        if verbose:
            opts += ["-v"]
        if android:
            # Ensure the APK builder submodule has been built first
            apk_builder_dir = "support/android-rs-glue"
            with cd(path.join(apk_builder_dir, "apk-builder")):
                subprocess.call(["cargo", "build"], env=self.build_env())

            opts += ["--target", "arm-linux-androideabi"]

        if debug_mozjs or self.config["build"]["debug-mozjs"]:
            features += ["script/debugmozjs"]

        if is_headless_build():
            opts += ["--no-default-features"]
            features += ["headless"]

        if android:
            features += ["android_glue"]

        if features:
            opts += ["--features", "%s" % ' '.join(features)]

        build_start = time()
        env = self.build_env()
        if android:
            # Build OpenSSL for android
            with cd(self.android_support_dir()):
                status = subprocess.call(
                    ["make", "-j4", "-f", "openssl.makefile"],
                    env=self.build_env())
            env['OPENSSL_PATH'] = path.join(self.android_support_dir(), "openssl-1.0.1k")

        status = subprocess.call(
            ["cargo", "build"] + opts,
            env=env, cwd=self.servo_crate())
        elapsed = time() - build_start

        print("Build completed in %0.2fs" % elapsed)
        return status
开发者ID:shanil-puri,项目名称:servo,代码行数:56,代码来源:build_commands.py


示例2: update_cargo

    def update_cargo(self, params):
        cargo_paths = [path.join("."), path.join("ports", "cef"), path.join("ports", "android", "glut_app")]

        for cargo_path in cargo_paths:
            with cd(cargo_path):
                print(cargo_path)
                subprocess.call(["cargo", "update"] + params, env=self.build_env())
开发者ID:0b10011,项目名称:servo,代码行数:7,代码来源:devenv_commands.py


示例3: test_stylo

    def test_stylo(self, release=False):
        self.set_use_stable_rust()
        self.ensure_bootstrapped()

        env = self.build_env()
        env["RUST_BACKTRACE"] = "1"
        env["CARGO_TARGET_DIR"] = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")

        release = ["--release"] if release else []
        ret = 0
        with cd(path.join("ports", "geckolib")):
            ret = call(["cargo", "test", "-p", "stylo_tests"] + release, env=env)
        if ret != 0:
            return ret
        with cd(path.join("ports", "geckolib")):
            return call(["cargo", "test", "-p", "style"] + release, env=env)
开发者ID:hgallagher1993,项目名称:servo,代码行数:16,代码来源:testing_commands.py


示例4: build_geckolib

    def build_geckolib(self, jobs=None, verbose=False, release=False):
        self.set_use_stable_rust()
        self.ensure_bootstrapped()

        ret = None
        opts = []
        if jobs is not None:
            opts += ["-j", jobs]
        if verbose:
            opts += ["-v"]
        if release:
            opts += ["--release"]

        env = self.build_env(is_build=True)
        env["CARGO_TARGET_DIR"] = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")

        build_start = time()
        with cd(path.join("ports", "geckolib")):
            ret = call(["cargo", "build"] + opts, env=env, verbose=verbose)
        elapsed = time() - build_start

        # Generate Desktop Notification if elapsed-time > some threshold value
        notify_build_done(elapsed)

        print("GeckoLib build completed in %s" % format_duration(elapsed))

        return ret
开发者ID:AgostonSzepessy,项目名称:servo,代码行数:27,代码来源:build_commands.py


示例5: build_gonk

    def build_gonk(self, jobs=None, verbose=False, release=False):
        self.ensure_bootstrapped()

        ret = None
        opts = []
        if jobs is not None:
            opts += ["-j", jobs]
        if verbose:
            opts += ["-v"]
        if release:
            opts += ["--release"]

        opts += ["--target", "arm-linux-androideabi"]
        env = self.build_env(gonk=True)
        build_start = time()
        with cd(path.join("ports", "gonk")):
            ret = subprocess.call(["cargo", "build"] + opts, env=env)
        elapsed = time() - build_start

        # Generate Desktop Notification if elapsed-time > some threshold value
        notify_build_done(elapsed)

        print("Gonk build completed in %0.2fs" % elapsed)

        return ret
开发者ID:boghison,项目名称:servo,代码行数:25,代码来源:build_commands.py


示例6: update_submodules

 def update_submodules(self):
     # Ensure that the installed git version is >= 1.8.1
     gitversion_output = subprocess.check_output(["git", "--version"])
     gitversion = LooseVersion(gitversion_output.split(" ")[-1])
     if gitversion < LooseVersion("1.8.1"):
         print("Git version 1.8.1 or above required. Current version is {}"
               .format(gitversion))
         sys.exit(1)
     submodules = subprocess.check_output(["git", "submodule", "status"])
     for line in submodules.split('\n'):
         components = line.strip().split(' ')
         if len(components) > 1:
             module_path = components[1]
             if path.exists(module_path):
                 with cd(module_path):
                     output = subprocess.check_output(
                         ["git", "status", "--porcelain"])
                     if len(output) != 0:
                         print("error: submodule %s is not clean"
                               % module_path)
                         print("\nClean the submodule and try again.")
                         return 1
     subprocess.check_call(
         ["git", "submodule", "--quiet", "sync", "--recursive"])
     subprocess.check_call(
         ["git", "submodule", "update", "--init", "--recursive"])
开发者ID:jxs,项目名称:servo,代码行数:26,代码来源:bootstrap_commands.py


示例7: run_cargo

    def run_cargo(self, params, geckolib=False, check=False):
        if geckolib:
            self.set_use_stable_rust()
            crate_dir = path.join('ports', 'geckolib')
        else:
            crate_dir = path.join('components', 'servo')

        self.ensure_bootstrapped()
        self.ensure_clobbered()
        env = self.build_env(geckolib=geckolib)

        if not params:
            params = []

        if check:
            params = ['check'] + params

        build_start = time()
        if self.context.topdir == getcwd():
            with cd(crate_dir):
                status = call(['cargo'] + params, env=env)
        else:
            status = call(['cargo'] + params, env=env)
        elapsed = time() - build_start

        notify_build_done(self.config, elapsed, status == 0)

        if check and status == 0:
            print('Finished checking, binary NOT updated. Consider ./mach build before ./mach run')

        return status
开发者ID:stjepang,项目名称:servo,代码行数:31,代码来源:devenv_commands.py


示例8: fetch

    def fetch(self):
        # Fetch Rust and Cargo
        self.ensure_bootstrapped()

        # Fetch Cargo dependencies
        with cd(self.context.topdir):
            call(["cargo", "fetch"], env=self.build_env())
开发者ID:Ms2ger,项目名称:servo,代码行数:7,代码来源:devenv_commands.py


示例9: build_gonk

    def build_gonk(self, jobs=None, verbose=False, release=False):
        target = "arm-linux-androideabi"
        self.ensure_bootstrapped(target=target)

        opts = []
        if jobs is not None:
            opts += ["-j", jobs]
        if verbose:
            opts += ["-v"]
        if release:
            opts += ["--release"]

        opts += ["--target", self.config["android"]["target"]]
        env = self.build_env(gonk=True)
        build_start = time()
        with cd(path.join("ports", "gonk")):
            ret = call(["cargo", "build"] + opts, env=env, verbose=verbose)
        elapsed = time() - build_start

        # Generate Desktop Notification if elapsed-time > some threshold value
        notify_build_done(elapsed)

        print("Gonk build completed in %s" % str(datetime.timedelta(seconds=elapsed)))

        return ret
开发者ID:Zaggy1024,项目名称:servo,代码行数:25,代码来源:build_commands.py


示例10: build_cef

    def build_cef(self, jobs=None, verbose=False, release=False,
                  with_debug_assertions=False):
        self.ensure_bootstrapped()

        ret = None
        opts = []
        if jobs is not None:
            opts += ["-j", jobs]
        if verbose:
            opts += ["-v"]
        if release:
            opts += ["--release"]

        servo_features = self.servo_features()
        if servo_features:
            opts += ["--features", "%s" % ' '.join(servo_features)]

        build_start = time()
        env = self.build_env(is_build=True)

        if with_debug_assertions:
            env["RUSTFLAGS"] = "-C debug_assertions"

        with cd(path.join("ports", "cef")):
            ret = call(["cargo", "build"] + opts,
                       env=env,
                       verbose=verbose)
        elapsed = time() - build_start

        # Generate Desktop Notification if elapsed-time > some threshold value
        notify_build_done(elapsed)

        print("CEF build completed in %s" % format_duration(elapsed))

        return ret
开发者ID:AgostonSzepessy,项目名称:servo,代码行数:35,代码来源:build_commands.py


示例11: build_geckolib

    def build_geckolib(self, jobs=None, verbose=False, release=False):
        self.set_use_stable_rust()
        self.ensure_bootstrapped()
        self.ensure_clobbered()

        env = self.build_env(is_build=True, geckolib=True)

        ret = None
        opts = []
        features = []
        if jobs is not None:
            opts += ["-j", jobs]
        if verbose:
            opts += ["-v"]
        if release:
            opts += ["--release"]
        else:
            features += ["gecko_debug"]

        if features:
            opts += ["--features", ' '.join(features)]

        build_start = time()
        with cd(path.join("ports", "geckolib")):
            ret = call(["cargo", "build"] + opts, env=env, verbose=verbose)
        elapsed = time() - build_start

        # Generate Desktop Notification if elapsed-time > some threshold value
        notify_build_done(self.config, elapsed)

        print("GeckoLib build completed in %s" % format_duration(elapsed))

        return ret
开发者ID:Wafflespeanut,项目名称:servo,代码行数:33,代码来源:build_commands.py


示例12: build_geckolib

    def build_geckolib(self, jobs=None, verbose=False, release=False):
        self.ensure_bootstrapped()

        ret = None
        opts = []
        if jobs is not None:
            opts += ["-j", jobs]
        if verbose:
            opts += ["-v"]
        if release:
            opts += ["--release"]

        build_start = time()
        env = self.build_env()
        with cd(path.join("ports", "geckolib")):
            ret = call(["cargo", "build"] + opts,
                       env=env, verbose=verbose)
        elapsed = time() - build_start

        # Generate Desktop Notification if elapsed-time > some threshold value
        notify_build_done(elapsed)

        print("GeckoLib build completed in %s" % format_duration(elapsed))

        return ret
开发者ID:MovingtoMars,项目名称:servo,代码行数:25,代码来源:build_commands.py


示例13: cargo

    def cargo(self, params):
        if not params:
            params = []

        if self.context.topdir == getcwd():
            with cd(path.join("components", "servo")):
                return subprocess.call(["cargo"] + params, env=self.build_env())
        return subprocess.call(["cargo"] + params, env=self.build_env())
开发者ID:tgummerer,项目名称:servo,代码行数:8,代码来源:devenv_commands.py


示例14: cargo

    def cargo(self, params):
        if not params:
            params = []

        if self.context.topdir == getcwd():
            with cd(path.join('components', 'servo')):
                return call(["cargo"] + params, env=self.build_env())
        return call(['cargo'] + params, env=self.build_env())
开发者ID:Ms2ger,项目名称:servo,代码行数:8,代码来源:devenv_commands.py


示例15: clippy

    def clippy(self, package=None, json=False):
        params = ["--features=script/plugins/clippy"]
        if package:
            params += ["-p", package]
        if json:
            params += ["--", "-Zunstable-options", "--error-format", "json"]

        with cd(path.join(self.context.topdir, "components", "servo")):
            return subprocess.call(["cargo", "rustc", "-v"] + params, env=self.build_env())
开发者ID:nnethercote,项目名称:servo,代码行数:9,代码来源:devenv_commands.py


示例16: fetch

    def fetch(self):
        # Fetch Rust and Cargo
        self.ensure_bootstrapped()

        # Fetch Cargo dependencies
        for cargo_path in CARGO_PATHS:
            with cd(cargo_path):
                print(cargo_path)
                call(["cargo", "fetch"], env=self.build_env())
开发者ID:BorisChiou,项目名称:servo,代码行数:9,代码来源:devenv_commands.py


示例17: package

    def package(self, release=False, dev=False, android=None, debug=False, debugger=None):
        env = self.build_env()
        if android is None:
            android = self.config["build"]["android"]
        binary_path = self.get_binary_path(release, dev, android=android)
        if android:
            if dev:
                env["NDK_DEBUG"] = "1"
                env["ANT_FLAVOR"] = "debug"
                dev_flag = "-d"
            else:
                env["ANT_FLAVOR"] = "release"
                dev_flag = ""

            target_dir = os.path.dirname(binary_path)
            output_apk = "{}.apk".format(binary_path)
            try:
                with cd(path.join("support", "android", "build-apk")):
                    subprocess.check_call(["cargo", "run", "--", dev_flag, "-o", output_apk, "-t", target_dir,
                                           "-r", self.get_top_dir()], env=env)
            except subprocess.CalledProcessError as e:
                print("Packaging Android exited with return value %d" % e.returncode)
                return e.returncode
        else:
            dir_to_package = '/'.join(binary_path.split('/')[:-1])
            browserhtml_path = find_dep_path_newest('browserhtml', binary_path)
            if browserhtml_path is None:
                print("Could not find browserhtml package; perhaps you haven't built Servo.")
                return 1
            print("Deleting unused files")
            keep = ['servo', 'resources', 'build']
            for f in os.listdir(dir_to_package + '/'):
                if f not in keep:
                    delete(dir_to_package + '/' + f)
            for f in os.listdir(dir_to_package + '/build/'):
                if 'browserhtml' not in f:
                    delete(dir_to_package + '/build/' + f)
            print("Writing runservo.sh")
            # TODO: deduplicate this arg list from post_build_commands
            servo_args = ['-w', '-b',
                          '--pref', 'dom.mozbrowser.enabled',
                          '--pref', 'dom.forcetouch.enabled',
                          '--pref', 'shell.quit-on-escape.enabled=false',
                          path.join(browserhtml_path, 'out', 'index.html')]

            runservo = os.open(dir_to_package + 'runservo.sh', os.O_WRONLY | os.O_CREAT, int("0755", 8))
            os.write(runservo, "./servo " + ' '.join(servo_args))
            os.close(runservo)
            print("Creating tarball")
            tar_path = '/'.join(dir_to_package.split('/')[:-1]) + '/'
            tar_path += datetime.utcnow().replace(microsecond=0).isoformat()
            tar_path += "-servo-tech-demo.tar.gz"
            with tarfile.open(tar_path, "w:gz") as tar:
                # arcname is to add by relative rather than absolute path
                tar.add(dir_to_package, arcname='servo/')
            print("Packaged Servo into " + tar_path)
开发者ID:DDEFISHER,项目名称:servo,代码行数:56,代码来源:package_commands.py


示例18: find_dep_path_newest

def find_dep_path_newest(package, bin_path):
    deps_path = path.join(path.split(bin_path)[0], "build")
    with cd(deps_path):
        print(os.getcwd())
        candidates = glob(package + '-*')
    candidates = (path.join(deps_path, c) for c in candidates)
    candidate_times = sorted(((path.getmtime(c), c) for c in candidates), reverse=True)
    if len(candidate_times) > 0:
        return candidate_times[0][1]
    return None
开发者ID:Dewb,项目名称:servo,代码行数:10,代码来源:post_build_commands.py


示例19: update_cargo

    def update_cargo(self, params):
        cargo_paths = [path.join('.'),
                       path.join('ports', 'cef'),
                       path.join('ports', 'android', 'glut_app')]

        for cargo_path in cargo_paths:
            with cd(cargo_path):
                print(cargo_path)
                subprocess.call(["cargo", "update"] + params,
                                env=self.build_env())
开发者ID:ProtectedMode,项目名称:servo,代码行数:10,代码来源:devenv_commands.py


示例20: test_stylo

    def test_stylo(self):
        self.set_use_stable_rust()
        self.ensure_bootstrapped()

        env = self.build_env()
        env["RUST_BACKTRACE"] = "1"
        env["CARGO_TARGET_DIR"] = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")

        with cd(path.join("ports", "geckolib")):
            return call(["cargo", "test", "-p", "stylo_tests"], env=env)
开发者ID:Jenselme,项目名称:servo,代码行数:10,代码来源:testing_commands.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python command_base.check_call函数代码示例发布时间:2022-05-27
下一篇:
Python command_base.call函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap