(filename, content)
| 5 | |
| 6 | |
| 7 | def _write_output(filename, content): |
| 8 | if os.path.exists(filename): |
| 9 | with open(filename, 'rt') as strm: |
| 10 | orig_content = strm.read() |
| 11 | |
| 12 | if orig_content == content: |
| 13 | return False |
| 14 | |
| 15 | dirpath = os.path.dirname(filename) |
| 16 | if not os.path.isdir(dirpath): |
| 17 | os.makedirs(dirpath) |
| 18 | |
| 19 | with open(filename, 'wt') as strm: |
| 20 | strm.write(content) |
| 21 | strm.flush() |
| 22 | |
| 23 | return True |
| 24 | |
| 25 | |
| 26 | def _main(): |