From aff14a77e7dd7d3986a72fba88f456a29f78d97d Mon Sep 17 00:00:00 2001 From: Zhuowei Zhang Date: Sun, 26 Jan 2020 10:33:14 -0500 Subject: [PATCH] mach: fix error on Python 3 when specifying a target Previously, when running Mach on Python 3, specifying a target when building causes this error: ``` TypeError: a bytes-like object is required, not 'str' File "/servo/python/servo/build_commands.py", line 241, in build self.ensure_bootstrapped(target=target) File "/servo/python/servo/command_base.py", line 1023, in ensure_bootstrapped ["rustup", "target", "list", "--installed", "--toolchain", toolchain] ``` This change encodes the target using utf-8 before comparing. Fixes #25614. --- python/servo/command_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 3235d7dda5c..8fca326031a 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -1019,7 +1019,7 @@ install them, let us know by filing a bug!") if component.encode("utf-8") not in installed: check_call(["rustup", "component", "add", "--toolchain", toolchain, component]) - if target and "uwp" not in target and target not in check_output( + if target and "uwp" not in target and target.encode("utf-8") not in check_output( ["rustup", "target", "list", "--installed", "--toolchain", toolchain] ): check_call(["rustup", "target", "add", "--toolchain", toolchain, target])