summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2019-07-23 13:30:12 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2019-07-23 13:30:12 +0200
commit7b1d732af9a59f0e1b1261c90340d8e11b2f96d3 (patch)
tree0976d211d18e04de0f50b54aaa54a82db038af8e /script
parent77340fd25f9cdc798fc2ea9d89ab3e3d16bf7882 (diff)
parent9c04223086bf606eaac6dc2848af80518210d823 (diff)
Update upstream source from tag 'upstream/3.1.0'
Update to upstream version '3.1.0' with Debian dir 248b875f378ce1bab3315f6ed2cecdf63a4cc3cc
Diffstat (limited to 'script')
-rwxr-xr-xscript/scons8
-rw-r--r--script/scons-configure-cache8
-rw-r--r--script/scons-time81
-rw-r--r--script/scons.bat4
-rw-r--r--script/sconsign106
5 files changed, 106 insertions, 101 deletions
diff --git a/script/scons b/script/scons
index c0fe872..98f4e62 100755
--- a/script/scons
+++ b/script/scons
@@ -25,15 +25,15 @@
from __future__ import print_function
-__revision__ = "src/script/scons.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/script/scons.py ae4de9ab2249be220b6658a514eef8c3a57afc04 2019-07-21 02:32:15 bdeegan"
-__version__ = "3.0.5"
+__version__ = "3.1.0"
-__build__ = "a56bbd8c09fb219ab8a9673330ffcd55279219d0"
+__build__ = "ae4de9ab2249be220b6658a514eef8c3a57afc04"
__buildsys__ = "kufra"
-__date__ = "2019-03-26 23:16:31"
+__date__ = "2019-07-21 02:32:15"
__developer__ = "bdeegan"
diff --git a/script/scons-configure-cache b/script/scons-configure-cache
index 798b8fa..757a79f 100644
--- a/script/scons-configure-cache
+++ b/script/scons-configure-cache
@@ -37,15 +37,15 @@ import glob
import json
import os
-__revision__ = "src/script/scons-configure-cache.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/script/scons-configure-cache.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
-__version__ = "3.0.5"
+__version__ = "3.1.0"
-__build__ = "a56bbd8c09fb219ab8a9673330ffcd55279219d0"
+__build__ = "e724ae812eb96f4858a132f5b8c769724744faf6"
__buildsys__ = "kufra"
-__date__ = "2019-03-26 23:16:31"
+__date__ = "2019-07-21 00:04:47"
__developer__ = "bdeegan"
diff --git a/script/scons-time b/script/scons-time
index 26ddd77..975ff64 100644
--- a/script/scons-time
+++ b/script/scons-time
@@ -31,7 +31,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from __future__ import division, print_function
-__revision__ = "src/script/scons-time.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/script/scons-time.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import getopt
import glob
@@ -41,21 +41,7 @@ import shutil
import sys
import tempfile
import time
-
-def make_temp_file(**kw):
- try:
- result = tempfile.mktemp(**kw)
- result = os.path.realpath(result)
- except TypeError:
- try:
- save_template = tempfile.template
- prefix = kw['prefix']
- del kw['prefix']
- tempfile.template = prefix
- result = tempfile.mktemp(**kw)
- finally:
- tempfile.template = save_template
- return result
+import subprocess
def HACK_for_exec(cmd, *args):
"""
@@ -121,7 +107,7 @@ class Line(object):
# in the line's index number. We might want to represent
# this some way rather than just drawing the line straight
# between the two points on either side.
- if not y is None:
+ if y is not None:
print(fmt % (x, y))
print('e')
@@ -155,13 +141,13 @@ class Gnuplotter(Plotter):
result = []
for line in self.lines:
result.extend(line.get_x_values())
- return [r for r in result if not r is None]
+ return [r for r in result if r is not None]
def get_all_y_values(self):
result = []
for line in self.lines:
result.extend(line.get_y_values())
- return [r for r in result if not r is None]
+ return [r for r in result if r is not None]
def get_min_x(self):
try:
@@ -248,14 +234,16 @@ def unzip(fname):
os.makedirs(dir)
except:
pass
- open(name, 'wb').write(zf.read(name))
+ with open(name, 'wb') as f:
+ f.write(zf.read(name))
def read_tree(dir):
for dirpath, dirnames, filenames in os.walk(dir):
for fn in filenames:
fn = os.path.join(dirpath, fn)
if os.path.isfile(fn):
- open(fn, 'rb').read()
+ with open(fn, 'rb') as f:
+ f.read()
def redirect_to_file(command, log):
return '%s > %s 2>&1' % (command, log)
@@ -264,7 +252,7 @@ def tee_to_file(command, log):
return '%s 2>&1 | tee %s' % (command, log)
-
+
class SConsTimer(object):
"""
Usage: scons-time SUBCOMMAND [ARGUMENTS]
@@ -360,7 +348,7 @@ class SConsTimer(object):
'SCons' : 'Total SCons execution time',
'commands' : 'Total command execution time',
}
-
+
time_string_all = 'Total .* time'
#
@@ -456,14 +444,20 @@ class SConsTimer(object):
def log_execute(self, command, log):
command = self.subst(command, self.__dict__)
- output = os.popen(command).read()
+ p = os.popen(command)
+ output = p.read()
+ p.close()
+ #TODO: convert to subrocess, os.popen is obsolete. This didn't work:
+ #process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
+ #output = process.stdout.read()
+ #process.stdout.close()
+ #process.wait()
if self.verbose:
sys.stdout.write(output)
# TODO: Figure out
# Not sure we need to write binary here
- open(log, 'w').write(output)
-
- #
+ with open(log, 'w') as f:
+ f.write(str(output))
def archive_splitext(self, path):
"""
@@ -628,13 +622,14 @@ class SConsTimer(object):
search_string = self.time_string_all
else:
search_string = time_string
- contents = open(file).read()
+ with open(file) as f:
+ contents = f.read()
if not contents:
sys.stderr.write('file %s has no contents!\n' % repr(file))
return None
result = re.findall(r'%s: ([\d\.]*)' % search_string, contents)[-4:]
result = [ float(r) for r in result ]
- if not time_string is None:
+ if time_string is not None:
try:
result = result[0]
except IndexError:
@@ -673,7 +668,8 @@ class SConsTimer(object):
search_string = self.memory_string_all
else:
search_string = memory_string
- lines = open(file).readlines()
+ with open(file) as f:
+ lines = f.readlines()
lines = [ l for l in lines if l.startswith(search_string) ][-4:]
result = [ int(l.split()[-1]) for l in lines[-4:] ]
if len(result) == 1:
@@ -685,14 +681,14 @@ class SConsTimer(object):
Returns the counts of the specified object_name.
"""
object_string = ' ' + object_name + '\n'
- lines = open(file).readlines()
+ with open(file) as f:
+ lines = f.readlines()
line = [ l for l in lines if l.endswith(object_string) ][0]
result = [ int(field) for field in line.split()[:4] ]
if index is not None:
result = result[index]
return result
- #
command_alias = {}
@@ -925,7 +921,7 @@ class SConsTimer(object):
elif o in ('-p', '--prefix'):
self.prefix = a
elif o in ('--stage',):
- if not a in self.stages:
+ if a not in self.stages:
sys.stderr.write('%s: mem: Unrecognized stage "%s".\n' % (self.name, a))
sys.exit(1)
stage = a
@@ -1039,7 +1035,7 @@ class SConsTimer(object):
elif o in ('-p', '--prefix'):
self.prefix = a
elif o in ('--stage',):
- if not a in self.stages:
+ if a not in self.stages:
sys.stderr.write('%s: obj: Unrecognized stage "%s".\n' % (self.name, a))
sys.stderr.write('%s Type "%s help obj" for help.\n' % (self.name_spaces, self.name))
sys.exit(1)
@@ -1239,7 +1235,7 @@ class SConsTimer(object):
return os.path.join(dir, 'src', 'engine')
def prep_aegis_run(self, commands, removals):
- self.aegis_tmpdir = make_temp_file(prefix = self.name + '-aegis-')
+ self.aegis_tmpdir = tempfile.mkdtemp(prefix=self.name + '-aegis-')
removals.append((shutil.rmtree, 'rm -rf %%s', self.aegis_tmpdir))
self.aegis_parent_project = os.path.splitext(self.aegis_project)[0]
@@ -1247,21 +1243,19 @@ class SConsTimer(object):
self.scons_lib_dir = self.scons_lib_dir_path(self.aegis_tmpdir)
commands.extend([
- 'mkdir %(aegis_tmpdir)s',
(lambda: os.chdir(self.aegis_tmpdir), 'cd %(aegis_tmpdir)s'),
'%(aegis)s -cp -ind -p %(aegis_parent_project)s .',
'%(aegis)s -cp -ind -p %(aegis_project)s -delta %(run_number)s .',
])
def prep_subversion_run(self, commands, removals):
- self.svn_tmpdir = make_temp_file(prefix = self.name + '-svn-')
+ self.svn_tmpdir = tempfile.mkdtemp(prefix=self.name + '-svn-')
removals.append((shutil.rmtree, 'rm -rf %%s', self.svn_tmpdir))
self.scons = self.scons_path(self.svn_tmpdir)
self.scons_lib_dir = self.scons_lib_dir_path(self.svn_tmpdir)
commands.extend([
- 'mkdir %(svn_tmpdir)s',
'%(svn)s co %(svn_co_flag)s -r %(run_number)s %(subversion_url)s %(svn_tmpdir)s',
])
@@ -1308,11 +1302,9 @@ class SConsTimer(object):
if self.targets2 is None:
self.targets2 = self.targets
- self.tmpdir = make_temp_file(prefix = self.name + '-')
+ self.tmpdir = tempfile.mkdtemp(prefix=self.name + '-')
commands.extend([
- 'mkdir %(tmpdir)s',
-
(os.chdir, 'cd %%s', self.tmpdir),
])
@@ -1365,7 +1357,6 @@ class SConsTimer(object):
if not os.environ.get('PRESERVE'):
commands.extend(removals)
-
commands.append((shutil.rmtree, 'rm -rf %%s', self.tmpdir))
self.run_command_list(commands, self.__dict__)
@@ -1432,14 +1423,16 @@ class SConsTimer(object):
elif o in ('--title',):
self.title = a
elif o in ('--which',):
- if not a in list(self.time_strings.keys()):
+ if a not in list(self.time_strings.keys()):
sys.stderr.write('%s: time: Unrecognized timer "%s".\n' % (self.name, a))
sys.stderr.write('%s Type "%s help time" for help.\n' % (self.name_spaces, self.name))
sys.exit(1)
which = a
if self.config_file:
- HACK_for_exec(open(self.config_file, 'r').read(), self.__dict__)
+ with open(self.config_file, 'r') as f:
+ config = f.read()
+ HACK_for_exec(config, self.__dict__)
if self.chdir:
os.chdir(self.chdir)
diff --git a/script/scons.bat b/script/scons.bat
index 45c77ab..75e2a49 100644
--- a/script/scons.bat
+++ b/script/scons.bat
@@ -1,11 +1,11 @@
@REM Copyright (c) 2001 - 2019 The SCons Foundation
-@REM src/script/scons.bat a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan
+@REM src/script/scons.bat e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan
@echo off
set SCONS_ERRORLEVEL=
if "%OS%" == "Windows_NT" goto WinNT
@REM for 9x/Me you better not have more than 9 args
-python -c "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-3.0.5'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-3.0.5'), join(sys.prefix, 'scons')] + sys.path; import SCons.Script; SCons.Script.main()" %1 %2 %3 %4 %5 %6 %7 %8 %9
+python -c "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-3.1.0'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-3.1.0'), join(sys.prefix, 'scons')] + sys.path; import SCons.Script; SCons.Script.main()" %1 %2 %3 %4 %5 %6 %7 %8 %9
@REM no way to set exit status of this script for 9x/Me
goto endscons
diff --git a/script/sconsign b/script/sconsign
index 3b1e52d..3e8d4cf 100644
--- a/script/sconsign
+++ b/script/sconsign
@@ -25,15 +25,15 @@
from __future__ import print_function
-__revision__ = "src/script/sconsign.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/script/sconsign.py ae4de9ab2249be220b6658a514eef8c3a57afc04 2019-07-21 02:32:15 bdeegan"
-__version__ = "3.0.5"
+__version__ = "3.1.0"
-__build__ = "a56bbd8c09fb219ab8a9673330ffcd55279219d0"
+__build__ = "ae4de9ab2249be220b6658a514eef8c3a57afc04"
__buildsys__ = "kufra"
-__date__ = "2019-03-26 23:16:31"
+__date__ = "2019-07-21 02:32:15"
__developer__ = "bdeegan"
@@ -117,7 +117,7 @@ else:
# check `pwd`/lib/scons*.
temp.append(os.getcwd())
else:
- if script_dir == '.' or script_dir == '':
+ if script_dir in ('.', ''):
script_dir = os.getcwd()
head, tail = os.path.split(script_dir)
if tail == "bin":
@@ -185,13 +185,13 @@ import SCons.compat
try:
import whichdb
+
whichdb = whichdb.whichdb
except ImportError as e:
from dbm import whichdb
import time
import pickle
-import imp
import SCons.SConsign
@@ -200,9 +200,8 @@ def my_whichdb(filename):
if filename[-7:] == ".dblite":
return "SCons.dblite"
try:
- f = open(filename + ".dblite", "rb")
- f.close()
- return "SCons.dblite"
+ with open(filename + ".dblite", "rb"):
+ return "SCons.dblite"
except IOError:
pass
return _orig_whichdb(filename)
@@ -217,6 +216,8 @@ whichdb = my_whichdb
#dbm.whichdb = my_whichdb
def my_import(mname):
+ import imp
+
if '.' in mname:
i = mname.rfind('.')
parent = my_import(mname[:i])
@@ -247,9 +248,8 @@ Readable = 0
Warns = 0
-
def default_mapper(entry, name):
- '''
+ """
Stringify an entry that doesn't have an explicit mapping.
Args:
@@ -258,10 +258,10 @@ def default_mapper(entry, name):
Returns: str
- '''
+ """
try:
val = eval("entry." + name)
- except:
+ except AttributeError:
val = None
if sys.version_info.major >= 3 and isinstance(val, bytes):
# This is a dirty hack for py 2/3 compatibility. csig is a bytes object
@@ -272,7 +272,7 @@ def default_mapper(entry, name):
def map_action(entry, _):
- '''
+ """
Stringify an action entry and signature.
Args:
@@ -281,7 +281,7 @@ def map_action(entry, _):
Returns: str
- '''
+ """
try:
bact = entry.bact
bactsig = entry.bactsig
@@ -289,8 +289,9 @@ def map_action(entry, _):
return None
return '%s [%s]' % (bactsig, bact)
+
def map_timestamp(entry, _):
- '''
+ """
Stringify a timestamp entry.
Args:
@@ -299,7 +300,7 @@ def map_timestamp(entry, _):
Returns: str
- '''
+ """
try:
timestamp = entry.timestamp
except AttributeError:
@@ -309,8 +310,9 @@ def map_timestamp(entry, _):
else:
return str(timestamp)
+
def map_bkids(entry, _):
- '''
+ """
Stringify an implicit entry.
Args:
@@ -319,7 +321,7 @@ def map_bkids(entry, _):
Returns: str
- '''
+ """
try:
bkids = entry.bsources + entry.bdepends + entry.bimplicit
bkidsigs = entry.bsourcesigs + entry.bdependsigs + entry.bimplicitsigs
@@ -448,8 +450,8 @@ class Do_SConsignDB(object):
def __call__(self, fname):
# The *dbm modules stick their own file suffixes on the names
- # that are passed in. This is causes us to jump through some
- # hoops here to be able to allow the user
+ # that are passed in. This causes us to jump through some
+ # hoops here.
try:
# Try opening the specified file name. Example:
# SPECIFIED OPENED BY self.dbm.open()
@@ -461,16 +463,17 @@ class Do_SConsignDB(object):
print_e = e
try:
# That didn't work, so try opening the base name,
- # so that if the actually passed in 'sconsign.dblite'
+ # so that if they actually passed in 'sconsign.dblite'
# (for example), the dbm module will put the suffix back
# on for us and open it anyway.
db = self.dbm.open(os.path.splitext(fname)[0], "r")
except (IOError, OSError):
# That didn't work either. See if the file name
- # they specified just exists (independent of the dbm
+ # they specified even exists (independent of the dbm
# suffix-mangling).
try:
- open(fname, "r")
+ with open(fname, "rb"):
+ pass # this is a touch only, we don't use it here.
except (IOError, OSError) as e:
# Nope, that file doesn't even exist, so report that
# fact back.
@@ -486,6 +489,9 @@ class Do_SConsignDB(object):
except Exception as e:
sys.stderr.write("sconsign: ignoring invalid `%s' file `%s': %s\n"
% (self.dbm_name, fname, e))
+ exc_type, _, _ = sys.exc_info()
+ if exc_type.__name__ == "ValueError" and sys.version_info < (3,0,0):
+ sys.stderr.write("Python 2 only supports pickle protocols 0-2.\n")
return
if Print_Directories:
@@ -512,23 +518,23 @@ class Do_SConsignDB(object):
def Do_SConsignDir(name):
try:
- fp = open(name, 'rb')
+ with open(name, 'rb') as fp:
+ try:
+ sconsign = SCons.SConsign.Dir(fp)
+ except KeyboardInterrupt:
+ raise
+ except pickle.UnpicklingError:
+ err = "sconsign: ignoring invalid .sconsign file `%s'\n" % (name)
+ sys.stderr.write(err)
+ return
+ except Exception as e:
+ err = "sconsign: ignoring invalid .sconsign file `%s': %s\n" % (name, e)
+ sys.stderr.write(err)
+ return
+ printentries(sconsign.entries, args[0])
except (IOError, OSError) as e:
sys.stderr.write("sconsign: %s\n" % e)
return
- try:
- sconsign = SCons.SConsign.Dir(fp)
- except KeyboardInterrupt:
- raise
- except pickle.UnpicklingError:
- err = "sconsign: ignoring invalid .sconsign file `%s'\n" % (name)
- sys.stderr.write(err)
- return
- except Exception as e:
- err = "sconsign: ignoring invalid .sconsign file `%s': %s\n" % (name, e)
- sys.stderr.write(err)
- return
- printentries(sconsign.entries, args[0])
##############################################################################
@@ -536,7 +542,7 @@ def Do_SConsignDir(name):
import getopt
helpstr = """\
-Usage: sconsign [OPTIONS] FILE [...]
+Usage: sconsign [OPTIONS] [FILE ...]
Options:
-a, --act, --action Print build action information.
-c, --csig Print content signature information.
@@ -552,13 +558,17 @@ Options:
-v, --verbose Verbose, describe each field.
"""
-opts, args = getopt.getopt(sys.argv[1:], "acd:e:f:hirstv",
- ['act', 'action',
- 'csig', 'dir=', 'entry=',
- 'format=', 'help', 'implicit',
- 'raw', 'readable',
- 'size', 'timestamp', 'verbose'])
-
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "acd:e:f:hirstv",
+ ['act', 'action',
+ 'csig', 'dir=', 'entry=',
+ 'format=', 'help', 'implicit',
+ 'raw', 'readable',
+ 'size', 'timestamp', 'verbose'])
+except getopt.GetoptError as err:
+ sys.stderr.write(str(err) + '\n')
+ print(helpstr)
+ sys.exit(2)
for o, a in opts:
if o in ('-a', '--act', '--action'):
@@ -586,7 +596,7 @@ for o, a in opts:
# this was handled by calling my_import('SCons.dblite')
# again in earlier versions...
SCons.dblite.ignore_corrupt_dbfiles = 0
- except:
+ except ImportError:
sys.stderr.write("sconsign: illegal file format `%s'\n" % a)
print(helpstr)
sys.exit(2)
@@ -613,6 +623,8 @@ if Do_Call:
for a in args:
Do_Call(a)
else:
+ if not args:
+ args = [".sconsign.dblite"]
for a in args:
dbm_name = whichdb(a)
if dbm_name: