本文整理汇总了Python中servo.command_base.cd函数的典型用法代码示例。如果您正苦于以下问题:Python cd函数的具体用法?Python cd怎么用?Python cd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例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())
示例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)
示例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
示例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
示例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"])
示例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
示例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())
示例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
示例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
示例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
示例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
示例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())
示例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())
示例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())