mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Fix the docs build (#30058)
Type inference was incorrectly inferring that our `check_output()` helper was returning `str` when in reality, it returns `bytes`. This fixes the caller that was no longer decoding those bytes and fixes the type annotation on the function.
This commit is contained in:
parent
f3c7db7d0f
commit
6e84d47fd3
2 changed files with 8 additions and 6 deletions
|
@ -141,7 +141,7 @@ def call(*args, **kwargs):
|
||||||
return subprocess.call(*args, shell=sys.platform == 'win32', **kwargs)
|
return subprocess.call(*args, shell=sys.platform == 'win32', **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def check_output(*args, **kwargs):
|
def check_output(*args, **kwargs) -> bytes:
|
||||||
"""Wrap `subprocess.call`, printing the command if verbose=True."""
|
"""Wrap `subprocess.call`, printing the command if verbose=True."""
|
||||||
verbose = kwargs.pop('verbose', False)
|
verbose = kwargs.pop('verbose', False)
|
||||||
if verbose:
|
if verbose:
|
||||||
|
@ -980,10 +980,10 @@ class CommandBase(object):
|
||||||
|
|
||||||
servo.platform.get().passive_bootstrap()
|
servo.platform.get().passive_bootstrap()
|
||||||
|
|
||||||
needs_toolchain_install = self.cross_compile_target \
|
needs_toolchain_install = self.cross_compile_target and \
|
||||||
and self.cross_compile_target not in check_output(
|
self.cross_compile_target not in \
|
||||||
["rustup", "target", "list", "--installed"], cwd=self.context.topdir
|
check_output(["rustup", "target", "list", "--installed"],
|
||||||
)
|
cwd=self.context.topdir).decode()
|
||||||
if needs_toolchain_install:
|
if needs_toolchain_install:
|
||||||
check_call(["rustup", "target", "add", self.cross_compile_target],
|
check_call(["rustup", "target", "add", self.cross_compile_target],
|
||||||
cwd=self.context.topdir)
|
cwd=self.context.topdir)
|
||||||
|
|
|
@ -245,7 +245,9 @@ class PostBuildCommands(CommandBase):
|
||||||
@CommandBase.build_like_command_arguments
|
@CommandBase.build_like_command_arguments
|
||||||
def doc(self, params: List[str], **kwargs):
|
def doc(self, params: List[str], **kwargs):
|
||||||
self.ensure_bootstrapped()
|
self.ensure_bootstrapped()
|
||||||
rustc_path = check_output(["rustup" + BIN_SUFFIX, "which", "rustc"], cwd=self.context.topdir)
|
rustc_path = check_output(
|
||||||
|
["rustup" + BIN_SUFFIX, "which", "rustc"],
|
||||||
|
cwd=self.context.topdir).decode("utf-8")
|
||||||
assert path.basename(path.dirname(rustc_path)) == "bin"
|
assert path.basename(path.dirname(rustc_path)) == "bin"
|
||||||
toolchain_path = path.dirname(path.dirname(rustc_path))
|
toolchain_path = path.dirname(path.dirname(rustc_path))
|
||||||
rust_docs = path.join(toolchain_path, "share", "doc", "rust", "html")
|
rust_docs = path.join(toolchain_path, "share", "doc", "rust", "html")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue