diff options
| -rw-r--r-- | meta/lib/oeqa/utils/ftools.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/meta/lib/oeqa/utils/ftools.py b/meta/lib/oeqa/utils/ftools.py index 1ec8a0948f..1bd9a30a40 100644 --- a/meta/lib/oeqa/utils/ftools.py +++ b/meta/lib/oeqa/utils/ftools.py | |||
| @@ -3,11 +3,17 @@ import re | |||
| 3 | import errno | 3 | import errno |
| 4 | 4 | ||
| 5 | def write_file(path, data): | 5 | def write_file(path, data): |
| 6 | # In case data is None, return immediately | ||
| 7 | if data is None: | ||
| 8 | return | ||
| 6 | wdata = data.rstrip() + "\n" | 9 | wdata = data.rstrip() + "\n" |
| 7 | with open(path, "w") as f: | 10 | with open(path, "w") as f: |
| 8 | f.write(wdata) | 11 | f.write(wdata) |
| 9 | 12 | ||
| 10 | def append_file(path, data): | 13 | def append_file(path, data): |
| 14 | # In case data is None, return immediately | ||
| 15 | if data is None: | ||
| 16 | return | ||
| 11 | wdata = data.rstrip() + "\n" | 17 | wdata = data.rstrip() + "\n" |
| 12 | with open(path, "a") as f: | 18 | with open(path, "a") as f: |
| 13 | f.write(wdata) | 19 | f.write(wdata) |
| @@ -19,6 +25,9 @@ def read_file(path): | |||
| 19 | return data | 25 | return data |
| 20 | 26 | ||
| 21 | def remove_from_file(path, data): | 27 | def remove_from_file(path, data): |
| 28 | # In case data is None, return immediately | ||
| 29 | if data is None: | ||
| 30 | return | ||
| 22 | try: | 31 | try: |
| 23 | rdata = read_file(path) | 32 | rdata = read_file(path) |
| 24 | except IOError as e: | 33 | except IOError as e: |
