mirror of
https://git.yoctoproject.org/poky
synced 2026-04-10 23:02:25 +02:00
oeqa/utils/ftools: From functions that expect data, check if None
ftools functions that expect data may get 'None'; this patch does this check and return immediately if this is the case. (From OE-Core rev: 5eaa4fa30e2362e6dd572b8a6f7a909b608e14bf) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
900639c1b2
commit
cf311a770e
@@ -3,11 +3,17 @@ import re
|
||||
import errno
|
||||
|
||||
def write_file(path, data):
|
||||
# In case data is None, return immediately
|
||||
if data is None:
|
||||
return
|
||||
wdata = data.rstrip() + "\n"
|
||||
with open(path, "w") as f:
|
||||
f.write(wdata)
|
||||
|
||||
def append_file(path, data):
|
||||
# In case data is None, return immediately
|
||||
if data is None:
|
||||
return
|
||||
wdata = data.rstrip() + "\n"
|
||||
with open(path, "a") as f:
|
||||
f.write(wdata)
|
||||
@@ -19,6 +25,9 @@ def read_file(path):
|
||||
return data
|
||||
|
||||
def remove_from_file(path, data):
|
||||
# In case data is None, return immediately
|
||||
if data is None:
|
||||
return
|
||||
try:
|
||||
rdata = read_file(path)
|
||||
except IOError as e:
|
||||
|
||||
Reference in New Issue
Block a user