aboutsummaryrefslogtreecommitdiff
path: root/tools/patman/tools.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-07-05 21:41:50 -0600
committerSimon Glass <sjg@chromium.org>2020-07-24 19:25:15 -0600
commitfd70986a62afc291d3fbc172dc0c7219dc84d4b7 (patch)
tree4db2e6da3794fb533c345ef2987a2b0d7fc61063 /tools/patman/tools.py
parent7d5b04e8a533402799c39468ac880a22f67ffbc9 (diff)
patman: Add a test that uses gitpython
It is convenient to use gitpython to create a real git repo for testing patman's operation. Add a test for this. So far it just checks that patman produces the right number of patches for a branch. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman/tools.py')
-rw-r--r--tools/patman/tools.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index b50370dfe8..f402b9aab8 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -270,7 +270,7 @@ def ReadFile(fname, binary=True):
#(fname, len(data), len(data)))
return data
-def WriteFile(fname, data):
+def WriteFile(fname, data, binary=True):
"""Write data into a file.
Args:
@@ -279,7 +279,7 @@ def WriteFile(fname, data):
"""
#self._out.Info("Write file '%s' size %d (%#0x)" %
#(fname, len(data), len(data)))
- with open(Filename(fname), 'wb') as fd:
+ with open(Filename(fname), binary and 'wb' or 'w') as fd:
fd.write(data)
def GetBytes(byte, size):