summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Holth <dholth@fastmail.fm>2016-06-20 02:50:06 (GMT)
committerDaniel Holth <dholth@fastmail.fm>2016-06-20 02:50:06 (GMT)
commit1d93e3871ee6858e3bc362aa4e9822c29aadb1a3 (patch)
tree24bb7f92a4d40fa81ae9865b3c317ef9e0dfd430
parent707a453c9c9db84449c4d3bf214b9ec65f2807db (diff)
downloadSCons-1d93e3871ee6858e3bc362aa4e9822c29aadb1a3.zip
SCons-1d93e3871ee6858e3bc362aa4e9822c29aadb1a3.tar.gz
SCons-1d93e3871ee6858e3bc362aa4e9822c29aadb1a3.tar.bz2
'with open' in own SConstruct
-rw-r--r--SConstruct6
1 files changed, 4 insertions, 2 deletions
diff --git a/SConstruct b/SConstruct
index 5eded92..c5734af 100644
--- a/SConstruct
+++ b/SConstruct
@@ -356,7 +356,8 @@ try:
if os.path.isfile(dest) or os.path.islink(dest):
os.unlink(dest)
if not os.path.isdir(dest):
- open(dest, 'wb').write(zf.read(name))
+ with open(dest, 'wb') as fp:
+ fp.write(zf.read(name))
except ImportError:
if unzip and zip:
@@ -371,7 +372,8 @@ def SCons_revision(target, source, env):
"""
t = str(target[0])
s = source[0].rstr()
- contents = open(s, 'rb').read()
+ with open(s, 'rb') as fp:
+ contents = fp.read()
# Note: We construct the __*__ substitution strings here
# so that they don't get replaced when this file gets
# copied into the tree for packaging.