diff options
author | William Deegan <bill@baddogconsulting.com> | 2020-02-05 22:00:30 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2020-02-05 22:00:30 (GMT) |
commit | 0f6204727a4b41d1d60192f1c50c64a8791af158 (patch) | |
tree | ae4a2ac760fa05a594f8ff78d3038b47eac450ea /site_scons | |
parent | c1481901781c23c3d4f25299513a10d6f1e2b7b6 (diff) | |
download | SCons-0f6204727a4b41d1d60192f1c50c64a8791af158.zip SCons-0f6204727a4b41d1d60192f1c50c64a8791af158.tar.gz SCons-0f6204727a4b41d1d60192f1c50c64a8791af158.tar.bz2 |
[ci skip] Fix SConsRevision.py to properly use with open as f instead of open, which was throwing warnings when run with newer pythons
Diffstat (limited to 'site_scons')
-rw-r--r-- | site_scons/SConsRevision.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/site_scons/SConsRevision.py b/site_scons/SConsRevision.py index 11de670..f6f7a71 100644 --- a/site_scons/SConsRevision.py +++ b/site_scons/SConsRevision.py @@ -29,12 +29,14 @@ def SCons_revision(target, source, env): contents = contents.replace('__REVISION' + '__', env['REVISION']) contents = contents.replace('__VERSION' + '__', env['VERSION']) contents = contents.replace('__NULL' + '__', '') - open(t, 'w').write(contents) + + with open(t,'w') as of: + of.write(contents) except UnicodeDecodeError as e: print("Error decoding file:%s just copying no revision edit") - with open(s, 'rb') as fp: + with open(s, 'rb') as fp, open(t, 'wb') as of: contents = fp.read() - open(t, 'wb').write(contents) + of.write(contents) os.chmod(t, os.stat(s)[0])
\ No newline at end of file |