From 3cb13d1d95dbb622f9629b129a999fe35480d260 Mon Sep 17 00:00:00 2001 From: Daniel Holth Date: Sun, 19 Jun 2016 22:50:06 -0400 Subject: 'with open' in own SConstruct --- SConstruct | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'SConstruct') diff --git a/SConstruct b/SConstruct index 5eded923..c5734af6 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. -- cgit v1.2.1