handle tempfile.TemporaryFile buffering changes in Python 3
Python 3 renamed the argument from "bufsize" to "buffering" to match
the underlying open function which uses "buffering" in both versions.
Add helpers to handle this minor difference.
BUG=chromium:997354
TEST=`./run_tests` passes, and some more tests pass under Python 3
Change-Id: Idbe5fcc860198e6cc20d7b0a977f71a0872a015e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1789422
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/cros_generate_breakpad_symbols.py b/scripts/cros_generate_breakpad_symbols.py
index 9740cac..7c36e9f 100644
--- a/scripts/cros_generate_breakpad_symbols.py
+++ b/scripts/cros_generate_breakpad_symbols.py
@@ -23,7 +23,6 @@
import ctypes
import multiprocessing
import os
-import tempfile
from chromite.lib import commandline
from chromite.lib import cros_build_lib
@@ -105,7 +104,7 @@
signals.StrSignal(-ret), msg)
osutils.SafeMakedirs(breakpad_dir)
- with tempfile.NamedTemporaryFile(dir=breakpad_dir, bufsize=0) as temp:
+ with cros_build_lib.UnbufferedNamedTemporaryFile(dir=breakpad_dir) as temp:
if debug_file:
# Try to dump the symbols using the debug file like normal.
cmd_args = [elf_file, os.path.dirname(debug_file)]