summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--QMTest/TestCmd.py1
-rw-r--r--QMTest/TestSCons.py7
-rw-r--r--QMTest/scons_tdb.py2
-rw-r--r--bench/bench.py1
-rw-r--r--bench/timeit.py1
-rw-r--r--bin/calibrate.py3
-rw-r--r--bin/linecount.py1
-rwxr-xr-xbin/svn-bisect.py3
-rw-r--r--src/engine/SCons/Defaults.py5
-rw-r--r--src/engine/SCons/Node/FSTests.py7
-rw-r--r--src/engine/SCons/Script/SConscript.py3
-rw-r--r--src/engine/SCons/TaskmasterTests.py5
-rw-r--r--src/engine/SCons/Tool/intelc.py4
-rw-r--r--src/script/scons-time.py8
-rw-r--r--test/option/debug-time.py2
15 files changed, 31 insertions, 22 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py
index 301e5a6a..1ee5d4e4 100644
--- a/QMTest/TestCmd.py
+++ b/QMTest/TestCmd.py
@@ -213,6 +213,7 @@ version.
# PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS,
# AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+from __future__ import division
__author__ = "Steven Knight <knight at baldmt dot com>"
__revision__ = "TestCmd.py 0.37.D001 2010/01/11 16:55:50 knight"
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py
index e35cbfed..f9e22509 100644
--- a/QMTest/TestSCons.py
+++ b/QMTest/TestSCons.py
@@ -13,6 +13,7 @@ attributes defined in this subclass.
"""
# __COPYRIGHT__
+from __future__ import division
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -994,13 +995,13 @@ class Stat:
StatList = [
Stat('memory-initial', 'kbytes',
r'Memory before reading SConscript files:\s+(\d+)',
- convert=lambda s: int(s) / 1024),
+ convert=lambda s: int(s) // 1024),
Stat('memory-prebuild', 'kbytes',
r'Memory before building targets:\s+(\d+)',
- convert=lambda s: int(s) / 1024),
+ convert=lambda s: int(s) // 1024),
Stat('memory-final', 'kbytes',
r'Memory after building targets:\s+(\d+)',
- convert=lambda s: int(s) / 1024),
+ convert=lambda s: int(s) // 1024),
Stat('time-sconscript', 'seconds',
r'Total SConscript file execution time:\s+([\d.]+) seconds'),
diff --git a/QMTest/scons_tdb.py b/QMTest/scons_tdb.py
index e2c40df7..6be4696b 100644
--- a/QMTest/scons_tdb.py
+++ b/QMTest/scons_tdb.py
@@ -20,7 +20,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
"""
QMTest classes to support SCons' testing and Aegis-inspired workflow.
diff --git a/bench/bench.py b/bench/bench.py
index 3391f9d9..74dbf121 100644
--- a/bench/bench.py
+++ b/bench/bench.py
@@ -23,6 +23,7 @@
#
# This will allow (as much as possible) us to time just the code itself,
# not Python function call overhead.
+from __future__ import division
import getopt
import sys
diff --git a/bench/timeit.py b/bench/timeit.py
index 199b7c93..ed94361f 100644
--- a/bench/timeit.py
+++ b/bench/timeit.py
@@ -46,6 +46,7 @@ be aware of it. The baseline overhead can be measured by invoking the
program without arguments. The baseline overhead differs between
Python versions!
"""
+from __future__ import division
try:
import gc
diff --git a/bin/calibrate.py b/bin/calibrate.py
index c5d45ce6..f377869e 100644
--- a/bin/calibrate.py
+++ b/bin/calibrate.py
@@ -20,6 +20,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
import optparse
import os
@@ -71,7 +72,7 @@ def main(argv=None):
good = 0
for v in vm.groups():
var, value = v.split('=', 1)
- value = int((int(value) * opts.max) / elapsed)
+ value = int((int(value) * opts.max) // elapsed)
os.environ[var] = str(value)
run += 1
diff --git a/bin/linecount.py b/bin/linecount.py
index 7dd4c20c..6f49dcad 100644
--- a/bin/linecount.py
+++ b/bin/linecount.py
@@ -21,6 +21,7 @@
# in each category, the number of non-blank lines, and the number of
# non-comment lines. The last figure (non-comment) lines is the most
# interesting one for most purposes.
+from __future__ import division
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
diff --git a/bin/svn-bisect.py b/bin/svn-bisect.py
index e9ebcf89..77bda58f 100755
--- a/bin/svn-bisect.py
+++ b/bin/svn-bisect.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- Python -*-
+from __future__ import division
import sys
from math import log, ceil
@@ -52,7 +53,7 @@ msg = "****** max %d revisions to test (bug bracketed by [%d,%d])"
while upper-lower > 1:
print msg % (ceil(log(upper-lower,2)), lower, upper)
- mid = int((lower + upper)/2)
+ mid = (lower + upper)//2
midfails = testfail(mid)
if midfails == lowerfails:
lower = mid
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py
index ece6d590..be6ea9ff 100644
--- a/src/engine/SCons/Defaults.py
+++ b/src/engine/SCons/Defaults.py
@@ -31,13 +31,12 @@ from distutils.msvccompiler.
# 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
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
import os
-import os.path
import errno
import shutil
import stat
@@ -435,7 +434,7 @@ class Variable_Method_Caller:
self.variable = variable
self.method = method
def __call__(self, *args, **kw):
- try: 1/0
+ try: 1//0
except ZeroDivisionError:
# Don't start iterating with the current stack-frame to
# prevent creating reference cycles (f_back is safe).
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index 7fcec8f4..38a895b6 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -20,6 +20,7 @@
# 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
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -1307,7 +1308,7 @@ class FSTestCase(_tempdirTestCase):
# We round down the current time to the nearest even integer
# value, subtract two to make sure the timestamp is not "now,"
# and then convert it back to a float.
- tstamp = float(int(time.time() / 2) * 2) - 2
+ tstamp = float(int(time.time() // 2) * 2) - 2.0
os.utime(test.workpath("tstamp"), (tstamp - 2.0, tstamp))
f = fs.File("tstamp")
t = f.get_timestamp()
@@ -1325,7 +1326,7 @@ class FSTestCase(_tempdirTestCase):
f2 = test.workpath('tdir2', 'file2')
test.write(f1, 'file1\n')
test.write(f2, 'file2\n')
- current_time = float(int(time.time() / 2) * 2)
+ current_time = float(int(time.time() // 2) * 2)
t1 = current_time - 4.0
t2 = current_time - 2.0
os.utime(f1, (t1 - 2.0, t1))
@@ -2786,7 +2787,7 @@ class RepositoryTestCase(_tempdirTestCase):
# We round down the current time to the nearest even integer
# value, subtract two to make sure the timestamp is not "now,"
# and then convert it back to a float.
- tstamp = float(int(time.time() / 2) * 2) - 2
+ tstamp = float(int(time.time() // 2) * 2) - 2.0
os.utime(test.workpath("rep2", "tstamp"), (tstamp - 2.0, tstamp))
f = fs.File("tstamp")
t = f.get_timestamp()
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py
index 5928a885..ed077ba9 100644
--- a/src/engine/SCons/Script/SConscript.py
+++ b/src/engine/SCons/Script/SConscript.py
@@ -26,6 +26,7 @@ files.
# 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
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -77,7 +78,7 @@ sconscript_chdir = 1
def get_calling_namespaces():
"""Return the locals and globals for the function that called
into this module in the current call stack."""
- try: 1/0
+ try: 1//0
except ZeroDivisionError:
# Don't start iterating with the current stack-frame to
# prevent creating reference cycles (f_back is safe).
diff --git a/src/engine/SCons/TaskmasterTests.py b/src/engine/SCons/TaskmasterTests.py
index 3dd22e3e..e95e92cc 100644
--- a/src/engine/SCons/TaskmasterTests.py
+++ b/src/engine/SCons/TaskmasterTests.py
@@ -20,6 +20,7 @@
# 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
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -969,7 +970,7 @@ class TaskmasterTestCase(unittest.TestCase):
t.exception_set(3)
assert t.exception == 3
- try: 1/0
+ try: 1//0
except: pass
t.exception_set(None)
exc_type, exc_value, exc_tb = t.exception
@@ -1010,7 +1011,7 @@ class TaskmasterTestCase(unittest.TestCase):
pass
try:
- 1/0
+ 1//0
except:
tb = sys.exc_info()[2]
t.exception_set((Exception3, "arg", tb))
diff --git a/src/engine/SCons/Tool/intelc.py b/src/engine/SCons/Tool/intelc.py
index 9f782eef..5629636b 100644
--- a/src/engine/SCons/Tool/intelc.py
+++ b/src/engine/SCons/Tool/intelc.py
@@ -30,7 +30,7 @@ selection method.
# 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
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -81,7 +81,7 @@ def linux_ver_normalize(vstr):
m = re.match(r'([0-9]+)\.([0-9]+)\.([0-9]+)', vstr)
if m:
vmaj,vmin,build = m.groups()
- return float(vmaj) * 10 + float(vmin) + float(build) / 1000.;
+ return float(vmaj) * 10. + float(vmin) + float(build) / 1000.;
else:
f = float(vstr)
if is_windows:
diff --git a/src/script/scons-time.py b/src/script/scons-time.py
index b35cc329..37ee5933 100644
--- a/src/script/scons-time.py
+++ b/src/script/scons-time.py
@@ -29,7 +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
from __future__ import nested_scopes
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -120,12 +120,12 @@ class Plotter:
between 5 and 9 horizontal lines on the graph, on some set of
boundaries that are multiples of 10/100/1000/etc.
"""
- i = largest / 5
+ i = largest // 5
if not i:
return largest
multiplier = 1
while i >= 10:
- i = i / 10
+ i = i // 10
multiplier = multiplier * 10
return i * multiplier
@@ -133,7 +133,7 @@ class Plotter:
# Round up to next integer.
largest = int(largest) + 1
increment = self.increment_size(largest)
- return ((largest + increment - 1) / increment) * increment
+ return ((largest + increment - 1) // increment) * increment
class Line:
def __init__(self, points, type, title, label, comment, fmt="%s %s"):
diff --git a/test/option/debug-time.py b/test/option/debug-time.py
index 39a47c1f..324dc284 100644
--- a/test/option/debug-time.py
+++ b/test/option/debug-time.py
@@ -20,7 +20,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
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"