summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorRussel Winder <russel@winder.org.uk>2015-12-24 16:32:14 (GMT)
committerRussel Winder <russel@winder.org.uk>2015-12-24 16:32:14 (GMT)
commit2a270c8f314e959c78e9deda29c8f250bb934dd6 (patch)
tree7008e644357036404f0861c8ba1bbbf43b2b4123 /src/script
parenta7d764ed831fa3243aa0bd3307f641e1e1f9f8a8 (diff)
parent9d558dd65deacc958edc1f0da2dab1ec56ff4e4e (diff)
downloadSCons-2a270c8f314e959c78e9deda29c8f250bb934dd6.zip
SCons-2a270c8f314e959c78e9deda29c8f250bb934dd6.tar.gz
SCons-2a270c8f314e959c78e9deda29c8f250bb934dd6.tar.bz2
Post merge commit for safety. Building Fortran code works, but tests fail.
Diffstat (limited to 'src/script')
-rw-r--r--src/script/scons-time.py45
-rw-r--r--src/script/scons.py4
-rw-r--r--src/script/sconsign.py37
3 files changed, 37 insertions, 49 deletions
diff --git a/src/script/scons-time.py b/src/script/scons-time.py
index 9737dfe..ebdaf08 100644
--- a/src/script/scons-time.py
+++ b/src/script/scons-time.py
@@ -42,53 +42,10 @@ import sys
import tempfile
import time
-try:
- sorted
-except NameError:
- # Pre-2.4 Python has no sorted() function.
- #
- # The pre-2.4 Python list.sort() method does not support
- # list.sort(key=) nor list.sort(reverse=) keyword arguments, so
- # we must implement the functionality of those keyword arguments
- # by hand instead of passing them to list.sort().
- def sorted(iterable, cmp=None, key=None, reverse=False):
- if key is not None:
- result = [(key(x), x) for x in iterable]
- else:
- result = iterable[:]
- if cmp is None:
- # Pre-2.3 Python does not support list.sort(None).
- result.sort()
- else:
- result.sort(cmp)
- if key is not None:
- result = [t1 for t0,t1 in result]
- if reverse:
- result.reverse()
- return result
-
-if os.environ.get('SCONS_HORRIBLE_REGRESSION_TEST_HACK') is not None:
- # We can't apply the 'callable' fixer until the floor is 2.6, but the
- # '-3' option to Python 2.6 and 2.7 generates almost ten thousand
- # warnings. This hack allows us to run regression tests with the '-3'
- # option by replacing the callable() built-in function with a hack
- # that performs the same function but doesn't generate the warning.
- # Note that this hack is ONLY intended to be used for regression
- # testing, and should NEVER be used for real runs.
- from types import ClassType
- def callable(obj):
- if hasattr(obj, '__call__'): return True
- if isinstance(obj, (ClassType, type)): return True
- return False
-
def make_temp_file(**kw):
try:
result = tempfile.mktemp(**kw)
- try:
- result = os.path.realpath(result)
- except AttributeError:
- # Python 2.1 has no os.path.realpath() method.
- pass
+ result = os.path.realpath(result)
except TypeError:
try:
save_template = tempfile.template
diff --git a/src/script/scons.py b/src/script/scons.py
index 25ae644..b5476b9 100644
--- a/src/script/scons.py
+++ b/src/script/scons.py
@@ -98,7 +98,7 @@ try:
except ImportError:
pass
else:
- # when running from an egg add the egg's directory
+ # when running from an egg add the egg's directory
try:
d = pkg_resources.get_distribution('scons')
except pkg_resources.DistributionNotFound:
@@ -191,7 +191,7 @@ if __name__ == "__main__":
except:
print("Import failed. Unable to find SCons files in:")
for path in libs:
- print(" %s" % path)
+ print(" {}".format(path))
raise
# this does all the work, and calls sys.exit
diff --git a/src/script/sconsign.py b/src/script/sconsign.py
index 9f75e3a..1a4caf7 100644
--- a/src/script/sconsign.py
+++ b/src/script/sconsign.py
@@ -57,6 +57,14 @@ import sys
# followed by generic) so we pick up the right version of the build
# engine modules if they're in either directory.
+
+if sys.version_info >= (3,0,0):
+ msg = "sconsign: *** Version %s does not run under Python version %s.\n\
+Python 3 is not yet supported.\n"
+ sys.stderr.write(msg % (__version__, sys.version.split()[0]))
+ sys.exit(1)
+
+
script_dir = sys.path[0]
if script_dir in sys.path:
@@ -67,6 +75,11 @@ libs = []
if "SCONS_LIB_DIR" in os.environ:
libs.append(os.environ["SCONS_LIB_DIR"])
+# - running from source takes priority (since 2.3.2), excluding SCONS_LIB_DIR settings
+script_path = os.path.abspath(os.path.dirname(__file__))
+source_path = os.path.join(script_path, '..', 'engine')
+libs.append(source_path)
+
local_version = 'scons-local-' + __version__
local = 'scons-local'
if script_dir:
@@ -286,7 +299,7 @@ def field(name, entry, verbose=Verbose):
def nodeinfo_raw(name, ninfo, prefix=""):
# This just formats the dictionary, which we would normally use str()
# to do, except that we want the keys sorted for deterministic output.
- d = ninfo.__dict__
+ d = ninfo.__getstate__()
try:
keys = ninfo.field_list + ['_version_id']
except AttributeError:
@@ -471,12 +484,22 @@ for o, a in opts:
elif o in ('-e', '--entry'):
Print_Entries.append(a)
elif o in ('-f', '--format'):
+ # Try to map the given DB format to a known module
+ # name, that we can then try to import...
Module_Map = {'dblite' : 'SCons.dblite',
'sconsign' : None}
dbm_name = Module_Map.get(a, a)
if dbm_name:
try:
- dbm = my_import(dbm_name)
+ if dbm_name != "SCons.dblite":
+ dbm = my_import(dbm_name)
+ else:
+ import SCons.dblite
+ dbm = SCons.dblite
+ # Ensure that we don't ignore corrupt DB files,
+ # this was handled by calling my_import('SCons.dblite')
+ # again in earlier versions...
+ SCons.dblite.ignore_corrupt_dbfiles = 0
except:
sys.stderr.write("sconsign: illegal file format `%s'\n" % a)
print(helpstr)
@@ -508,7 +531,15 @@ else:
dbm_name = dbm.whichdb(a)
if dbm_name:
Map_Module = {'SCons.dblite' : 'dblite'}
- dbm = my_import(dbm_name)
+ if dbm_name != "SCons.dblite":
+ dbm = my_import(dbm_name)
+ else:
+ import SCons.dblite
+ dbm = SCons.dblite
+ # Ensure that we don't ignore corrupt DB files,
+ # this was handled by calling my_import('SCons.dblite')
+ # again in earlier versions...
+ SCons.dblite.ignore_corrupt_dbfiles = 0
Do_SConsignDB(Map_Module.get(dbm_name, dbm_name), dbm)(a)
else:
Do_SConsignDir(a)