diff options
author | William Deegan <bill@baddogconsulting.com> | 2017-08-01 20:29:16 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2017-08-01 20:29:16 (GMT) |
commit | 0b639dc7557d416b1699e5043ec0998a8599bd49 (patch) | |
tree | b06ec42218d617e116dd3afcc262f20b5c2d763f /src/engine | |
parent | dbb74a49d9de365200c996e0088f97f78fd659b1 (diff) | |
parent | 82ab1dc920136d2fbc16db09c14f9c0435ccbc01 (diff) | |
download | SCons-0b639dc7557d416b1699e5043ec0998a8599bd49.zip SCons-0b639dc7557d416b1699e5043ec0998a8599bd49.tar.gz SCons-0b639dc7557d416b1699e5043ec0998a8599bd49.tar.bz2 |
Merged scons/scons into default
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Debug.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/linkloc.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Util.py | 5 | ||||
-rw-r--r-- | src/engine/SCons/Variables/__init__.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/cpp.py | 3 |
5 files changed, 12 insertions, 8 deletions
diff --git a/src/engine/SCons/Debug.py b/src/engine/SCons/Debug.py index 9e520ff..706b4c4 100644 --- a/src/engine/SCons/Debug.py +++ b/src/engine/SCons/Debug.py @@ -97,7 +97,8 @@ def dumpLoggedInstances(classes, file=sys.stdout): if sys.platform[:5] == "linux": # Linux doesn't actually support memory usage stats from getrusage(). def memory(): - mstr = open('/proc/self/stat').read() + with open('/proc/self/stat') as f: + mstr = f.read() mstr = mstr.split()[22] return int(mstr) elif sys.platform[:6] == 'darwin': @@ -233,6 +234,7 @@ def Trace(msg, file=None, mode='w', tstamp=None): PreviousTime = now fp.write(msg) fp.flush() + fp.close() # Local Variables: # tab-width:4 diff --git a/src/engine/SCons/Tool/linkloc.py b/src/engine/SCons/Tool/linkloc.py index bd643f7..c73852b 100644 --- a/src/engine/SCons/Tool/linkloc.py +++ b/src/engine/SCons/Tool/linkloc.py @@ -52,8 +52,8 @@ def repl_linker_command(m): # Replaces any linker command file directives (e.g. "@foo.lnk") with # the actual contents of the file. try: - f=open(m.group(2), "r") - return m.group(1) + f.read() + with open(m.group(2), "r") as f: + return m.group(1) + f.read() except IOError: # the linker should return an error if it can't # find the linker command file so we will remain quiet. diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 4d0df22..846d06c 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -1506,9 +1506,8 @@ def MD5signature(s): def MD5filesignature(fname, chunksize=65536): - f = open(fname, "rb") - result = f.read() - f.close() + with open(fname, "rb") as f: + result = f.read() return result try: diff --git a/src/engine/SCons/Variables/__init__.py b/src/engine/SCons/Variables/__init__.py index cd66604..1fe4435 100644 --- a/src/engine/SCons/Variables/__init__.py +++ b/src/engine/SCons/Variables/__init__.py @@ -175,7 +175,9 @@ class Variables(object): sys.path.insert(0, dir) try: values['__name__'] = filename - exec(open(filename, 'r').read(), {}, values) + with open(filename, 'r') as f: + contents = f.read() + exec(contents, {}, values) finally: if dir: del sys.path[0] diff --git a/src/engine/SCons/cpp.py b/src/engine/SCons/cpp.py index f282ba7..2e20017 100644 --- a/src/engine/SCons/cpp.py +++ b/src/engine/SCons/cpp.py @@ -379,7 +379,8 @@ class PreProcessor(object): return None def read_file(self, file): - return open(file).read() + with open(file) as f: + return f.read() # Start and stop processing include lines. |