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/pushimage.py b/scripts/pushimage.py
index b3168c9..cceff66 100644
--- a/scripts/pushimage.py
+++ b/scripts/pushimage.py
@@ -15,7 +15,6 @@
import getpass
import os
import re
-import tempfile
import textwrap
from six.moves import configparser
@@ -541,8 +540,8 @@
# Generate the insn file for this artifact that the signer will use,
# and flag it for signing.
- with tempfile.NamedTemporaryFile(
- bufsize=0, prefix='pushimage.insns.') as insns_path:
+ with cros_build_lib.UnbufferedNamedTemporaryFile(
+ prefix='pushimage.insns.') as insns_path:
input_insns.OutputInsns(insns_path.name, sect_insns, sect_general,
insns_merge=alt_insn_set)