summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorStefan Zimmermann <zimmermann.code@gmail.com>2014-03-31 15:13:02 +0000
committerStefan Zimmermann <zimmermann.code@gmail.com>2014-03-31 15:13:02 +0000
commit15ad84e7cd33f33d287c63d6e00a221d859cce3b (patch)
tree4464eb544fe0cc698ea4d1c5789e19770b83cd6f /src/script
parent9d3a9c2cc0187294500ea8018a7ffcc1c7b67037 (diff)
downloadscons-15ad84e7cd33f33d287c63d6e00a221d859cce3b.tar.gz
Made former 2to3 changes Python 2.7 compatible (or removed unneeded changes).
Diffstat (limited to 'src/script')
-rw-r--r--src/script/scons-time.py12
-rw-r--r--src/script/sconsign.py10
2 files changed, 14 insertions, 8 deletions
diff --git a/src/script/scons-time.py b/src/script/scons-time.py
index 4296192d..9737dfed 100644
--- a/src/script/scons-time.py
+++ b/src/script/scons-time.py
@@ -29,8 +29,7 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
+from __future__ import division, print_function
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -42,7 +41,6 @@ import shutil
import sys
import tempfile
import time
-import collections
try:
sorted
@@ -456,7 +454,7 @@ class SConsTimer(object):
Each message is prepended with a standard prefix of our name
plus the time.
"""
- if isinstance(msg, collections.Callable):
+ if callable(msg):
msg = msg(*args)
else:
msg = msg % args
@@ -475,7 +473,7 @@ class SConsTimer(object):
The action is called if it's a callable Python function, and
otherwise passed to os.system().
"""
- if isinstance(action, collections.Callable):
+ if callable(action):
action(*args)
else:
os.system(action % args)
@@ -697,7 +695,7 @@ class SConsTimer(object):
sys.stderr.write('%s Cannot use the "func" subcommand.\n' % self.name_spaces)
sys.exit(1)
statistics = pstats.Stats(file).stats
- matches = [ e for e in list(statistics.items()) if e[0][2] == function ]
+ matches = [ e for e in statistics.items() if e[0][2] == function ]
r = matches[0]
return r[0][0], r[0][1], r[0][2], r[1][3]
@@ -1467,7 +1465,7 @@ class SConsTimer(object):
elif o in ('--title',):
self.title = a
elif o in ('--which',):
- if not a in list(self.time_strings.keys()):
+ if not a in 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)
diff --git a/src/script/sconsign.py b/src/script/sconsign.py
index 323d1bff..e99a7414 100644
--- a/src/script/sconsign.py
+++ b/src/script/sconsign.py
@@ -22,6 +22,9 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+from __future__ import print_function
+
+from six import PY2, PY3
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -171,6 +174,8 @@ sys.path = libs + sys.path
import SCons.compat # so pickle will import cPickle instead
+if PY2:
+ import whichdb
import dbm
import time
import pickle
@@ -189,7 +194,10 @@ def my_whichdb(filename):
pass
return _orig_whichdb(filename)
-_orig_whichdb = dbm.whichdb
+if PY3:
+ _orig_whichdb = dbm.whichdb
+else:
+ _orig_whichdb = whichdb.whichdb
dbm.whichdb = my_whichdb
def my_import(mname):