diff options
author | Martin Robinson <mrobinson@igalia.com> | 2023-08-02 13:02:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-02 11:02:02 +0000 |
commit | 6e84d47fd36a8b3a5cd9f6f61dbc5192f586d498 (patch) | |
tree | 06a9d43d40fcfa2fb57e7d95b0be7b69ef21a2c2 | |
parent | f3c7db7d0f45cb935030bd5901133d7e6b9a023b (diff) | |
download | servo-6e84d47fd36a8b3a5cd9f6f61dbc5192f586d498.tar.gz servo-6e84d47fd36a8b3a5cd9f6f61dbc5192f586d498.zip |
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.
-rw-r--r-- | python/servo/command_base.py | 10 | ||||
-rw-r--r-- | python/servo/post_build_commands.py | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py index ce8c1ddb237..43d2e97d89c 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -141,7 +141,7 @@ def call(*args, **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.""" verbose = kwargs.pop('verbose', False) if verbose: @@ -980,10 +980,10 @@ class CommandBase(object): servo.platform.get().passive_bootstrap() - needs_toolchain_install = self.cross_compile_target \ - and self.cross_compile_target not in check_output( - ["rustup", "target", "list", "--installed"], cwd=self.context.topdir - ) + needs_toolchain_install = self.cross_compile_target and \ + self.cross_compile_target not in \ + check_output(["rustup", "target", "list", "--installed"], + cwd=self.context.topdir).decode() if needs_toolchain_install: check_call(["rustup", "target", "add", self.cross_compile_target], cwd=self.context.topdir) diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py index a9944775dda..78a9e2f6644 100644 --- a/python/servo/post_build_commands.py +++ b/python/servo/post_build_commands.py @@ -245,7 +245,9 @@ class PostBuildCommands(CommandBase): @CommandBase.build_like_command_arguments def doc(self, params: List[str], **kwargs): 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" toolchain_path = path.dirname(path.dirname(rustc_path)) rust_docs = path.join(toolchain_path, "share", "doc", "rust", "html") |