From e82f43c0d5a38aebe8f11000f46c137e45de20d1 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Wed, 15 Aug 2012 13:28:40 +0200 Subject: [PATCH] build.py simplifications --- utils/build.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/utils/build.py b/utils/build.py index 106659d776..8ebac8c4d2 100644 --- a/utils/build.py +++ b/utils/build.py @@ -34,9 +34,7 @@ def main(argv=None): for include in args.include: for filename in files[include]: - src = open(filename, 'r') - os.write(file, src.read()) - src.close() + with open(filename, 'r') as f: os.write(file, f.read()) # save @@ -51,13 +49,8 @@ def main(argv=None): # header - f = open(output,'r') - text = f.read() - f.close() - - f = open(output,'w') - f.write(("// %s - http://github.com/mrdoob/three.js\n" % os.path.basename(output)) + text) - f.close() + with open(output,'r') as f: text = f.read() + with open(output,'w') as f: f.write(("// %s - http://github.com/mrdoob/three.js\n" % os.path.basename(output)) + text) os.close(file) os.unlink(path) -- GitLab