diff options
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -8,7 +8,7 @@ from __future__ import print_function copyright_years = '2001 - 2019' # This gets inserted into the man pages to reflect the month of release. -month_year = 'March 2019' +month_year = 'July 2019' # # Copyright (c) 2001 - 2019 The SCons Foundation @@ -49,7 +49,7 @@ import textwrap import bootstrap project = 'scons' -default_version = '3.0.5' +default_version = '3.1.0' copyright = "Copyright (c) %s The SCons Foundation" % copyright_years SConsignFile() @@ -96,14 +96,16 @@ git_status_lines = [] if git: cmd = "%s ls-files 2> /dev/null" % git - git_status_lines = os.popen(cmd, "r").readlines() + with os.popen(cmd, "r") as p: + git_status_lines = p.readlines() revision = ARGUMENTS.get('REVISION', '') def generate_build_id(revision): return revision if not revision and git: - git_hash = os.popen("%s rev-parse HEAD 2> /dev/null" % git, "r").read().strip() + with os.popen("%s rev-parse HEAD 2> /dev/null" % git, "r") as p: + git_hash = p.read().strip() def generate_build_id(revision): result = git_hash if [l for l in git_status_lines if 'modified' in l]: @@ -206,7 +208,6 @@ packaging_flavors = [ "(including tests and documentation)."), ('src-zip', "A .zip file containing all the source " + "(including tests and documentation)."), - ] test_tar_gz_dir = os.path.join(build_dir, "test-tar-gz") @@ -551,7 +552,7 @@ for p in [ scons ]: # # Now run everything in src_file through the sed command we - # concocted to expand SConstruct, 3.0.5, etc. + # concocted to expand SConstruct, 3.1.0, etc. # for b in src_files: s = p['filemap'].get(b, b) @@ -575,10 +576,9 @@ for p in [ scons ]: def write_src_files(target, source, **kw): global src_files src_files.sort() - f = open(str(target[0]), 'w') - for file in src_files: - f.write(file + "\n") - f.close() + with open(str(target[0]), 'w') as f: + for file in src_files: + f.write(file + "\n") return 0 env.Command(os.path.join(build, 'MANIFEST'), MANIFEST_in_list, @@ -667,14 +667,14 @@ for p in [ scons ]: def Digestify(target, source, env): import hashlib src = source[0].rfile() - contents = open(str(src),'rb').read() + with open(str(src),'rb') as f: + contents = f.read() m = hashlib.md5() m.update(contents) sig = m.hexdigest() bytes = os.stat(str(src))[6] - open(str(target[0]), 'w').write("MD5 %s %s %d\n" % (sig, - src.name, - bytes)) + with open(str(target[0]), 'w') as f: + f.write("MD5 %s %s %d\n" % (sig, src.name, bytes)) env.Command(digest, tar_gz, Digestify) if not zipit: |