summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-10-20 20:42:45 (GMT)
committerGitHub <noreply@github.com>2017-10-20 20:42:45 (GMT)
commit45d8610e424ab53faa519e39d04592dcbcb93b09 (patch)
tree41986d1296089a17984af09fe07dce00eb691c01 /src
parent9d1dbea5f930d2c86430ddc58eadaa24d0b47803 (diff)
parentf335e6b2af2f554da43d4ae7896bc8fa3a487be7 (diff)
downloadSCons-45d8610e424ab53faa519e39d04592dcbcb93b09.zip
SCons-45d8610e424ab53faa519e39d04592dcbcb93b09.tar.gz
SCons-45d8610e424ab53faa519e39d04592dcbcb93b09.tar.bz2
Merge pull request #16 from bdbaddog/add_sconscript_timing
Add printing time processing each SConscript when --debug=time is specified on command line
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt1
-rw-r--r--src/engine/SCons/Script/SConscript.py9
2 files changed, 10 insertions, 0 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 373a9b3..07a1938 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -23,6 +23,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
8 years ago it was being used as a boolean parameter. Now you can specify sort to be a callable, or boolean
value. (True = normal sort). Manpage also updated.
- Fixed Tool loading logic from exploding sys.path with many site_scons/site_tools prepended on py3.
+ - Added additional output with time to process each SConscript file when using --debug=time.
From Thomas Berg:
- Fixed a regression in scons-3.0.0 where "from __future__ import print_function" was imposed
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py
index 8fea9c4..db6552c 100644
--- a/src/engine/SCons/Script/SConscript.py
+++ b/src/engine/SCons/Script/SConscript.py
@@ -44,12 +44,15 @@ import SCons.Script.Main
import SCons.Tool
import SCons.Util
+from . import Main
+
import collections
import os
import os.path
import re
import sys
import traceback
+import time
class SConscriptReturn(Exception):
pass
@@ -247,11 +250,17 @@ def _SConscript(fs, *files, **kw):
try:
try:
# _file_ = SCons.Util.to_str(_file_)
+ if Main.print_time:
+ time1 = time.time()
exec(compile(_file_.read(), _file_.name, 'exec'),
call_stack[-1].globals)
except SConscriptReturn:
pass
finally:
+ if Main.print_time:
+ time2 = time.time()
+ print('SConscript:%s took %0.3f ms' % (f.get_abspath(), (time2 - time1) * 1000.0))
+
if old_file is not None:
call_stack[-1].globals.update({__file__:old_file})
else: