diff options
author | Vincent Ricard <magic@magicninja.org> | 2020-12-28 22:31:49 +0100 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2021-02-18 09:35:46 -0500 |
commit | a627dde0d01e35a1cbdb62ca19ee0349757c34b0 (patch) | |
tree | 094b86f657d87bfc374d436da809aca26281069d /python/servo | |
parent | f73370088b77a834d9b9f6835ae90a4a66e6d7ee (diff) | |
download | servo-a627dde0d01e35a1cbdb62ca19ee0349757c34b0.tar.gz servo-a627dde0d01e35a1cbdb62ca19ee0349757c34b0.zip |
Port some code to Python3
Diffstat (limited to 'python/servo')
-rw-r--r-- | python/servo/command_base.py | 4 | ||||
-rw-r--r-- | python/servo/package_commands.py | 7 | ||||
-rw-r--r-- | python/servo/post_build_commands.py | 3 | ||||
-rw-r--r-- | python/servo/testing_commands.py | 5 |
4 files changed, 14 insertions, 5 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 7430247a2e3..fb1c79b8b3c 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -749,7 +749,7 @@ install them, let us know by filing a bug!") # Shorten hash # NOTE: Partially verifies the hash, but it will still pass if it's, e.g., a tree git_sha = subprocess.check_output([ - 'git', 'rev-parse', '--short', git_sha + 'git', 'rev-parse', '--short', git_sha.decode('ascii') ]) else: # This is a regular commit @@ -999,7 +999,7 @@ install them, let us know by filing a bug!") toolchain = self.rust_toolchain() status = subprocess.call( - ["rustup", "run", toolchain.encode("utf-8"), "rustc", "--version"], + ["rustup", "run", toolchain, "rustc", "--version"], stdout=open(os.devnull, "wb"), stderr=subprocess.STDOUT, ) diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py index e62a742589c..f44786251cc 100644 --- a/python/servo/package_commands.py +++ b/python/servo/package_commands.py @@ -775,7 +775,11 @@ def setup_uwp_signing(ms_app_store, publisher): def run_powershell_cmd(cmd): try: - return subprocess.check_output(['powershell.exe', '-NoProfile', '-Command', cmd]) + return ( + subprocess + .check_output(['powershell.exe', '-NoProfile', '-Command', cmd]) + .decode('utf-8') + ) except subprocess.CalledProcessError: print("ERROR: PowerShell command failed: ", cmd) exit(1) @@ -841,6 +845,7 @@ def build_uwp(platforms, dev, msbuild_dir, ms_app_store): .replace("%%PACKAGE_PLATFORMS%%", '|'.join(platforms)) .replace("%%CONFIGURATION%%", Configuration) .replace("%%SOLUTION%%", path.join(os.getcwd(), 'support', 'hololens', 'ServoApp.sln')) + .encode('utf-8') ) build_file.close() # Generate an appxbundle. diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py index 2e69c6ca917..daf2a9815ac 100644 --- a/python/servo/post_build_commands.py +++ b/python/servo/post_build_commands.py @@ -243,7 +243,8 @@ class PostBuildCommands(CommandBase): media_stack=None, **kwargs): self.ensure_bootstrapped(rustup_components=["rust-docs"]) rustc_path = check_output( - ["rustup" + BIN_SUFFIX, "which", "--toolchain", self.rust_toolchain(), "rustc"]) + ["rustup" + BIN_SUFFIX, "which", "--toolchain", self.rust_toolchain(), "rustc"] + ).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") diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 5d05eb60300..212371a58a0 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -585,7 +585,10 @@ class MachCommands(CommandBase): def format(outputs, description, file=sys.stdout): formatted = "%s %s:\n%s" % (len(outputs), description, "\n".join(outputs)) - file.write(formatted.encode("utf-8")) + if file == sys.stdout: + file.write(formatted) + else: + file.write(formatted.encode("utf-8")) if log_intermittents: with open(log_intermittents, "wb") as file: |