From 05310298d29cd326b8b0e2592298b0ccc4f08b8b Mon Sep 17 00:00:00 2001 From: mkarolin Date: Wed, 30 Jun 2021 16:32:04 -0400 Subject: [PATCH] [cr92 followup] Fixes signing on Windows. Fixes brave/brave-browser#16718 --- script/sign_binaries.py | 10 +++++----- tools/win/generate_breakpad_symbols.py | 13 +++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/script/sign_binaries.py b/script/sign_binaries.py index 4dc42a9ccdc9..5754f2b8d733 100644 --- a/script/sign_binaries.py +++ b/script/sign_binaries.py @@ -32,11 +32,11 @@ def get_sign_cmd(file): def run_cmd(cmd): - with subprocess.Popen(cmd, stdout=subprocess.PIPE) as p: - for line in p.stdout: - print(line) - p.wait() - assert p.returncode == 0, "Error signing" + p = subprocess.Popen(cmd, stdout=subprocess.PIPE) # pylint: disable=consider-using-with + for line in p.stdout: + print(line) + p.wait() + assert p.returncode == 0, "Error signing" def sign_binaries(base_dir, endswidth=('.exe', '.dll')): diff --git a/tools/win/generate_breakpad_symbols.py b/tools/win/generate_breakpad_symbols.py index ecbb7ba3705c..7c9c2281a39e 100644 --- a/tools/win/generate_breakpad_symbols.py +++ b/tools/win/generate_breakpad_symbols.py @@ -32,10 +32,10 @@ def GetCommandOutput(command): From chromium_utils. """ - with open(os.devnull, 'w') as devnull: - with subprocess.Popen(command, stdout=subprocess.PIPE, stderr=devnull, bufsize=1) as proc: - output = proc.communicate()[0] - return output.decode('utf-8') + devnull = open(os.devnull, 'w') # pylint: disable=consider-using-with + proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=devnull) # pylint: disable=consider-using-with + output = proc.communicate()[0] + return output.decode('utf-8') def mkdir_p(path): @@ -76,8 +76,9 @@ def _Worker(): module_line.group(1)) mkdir_p(output_path) symbol_file = "%s.sym" % module_line.group(2)[:-4] # strip .pdb - with open(os.path.join(output_path, symbol_file), 'w') as f: - f.write(syms) + f = open(os.path.join(output_path, symbol_file), 'w') # pylint: disable=consider-using-with + f.write(syms) + f.close() if options.verbose: with print_lock: