diff --git a/eng/scripts/CompareDirs.py b/eng/scripts/CompareDirs.py index 910a10ae9..b63651df4 100644 --- a/eng/scripts/CompareDirs.py +++ b/eng/scripts/CompareDirs.py @@ -21,14 +21,14 @@ def compare_dirs(dir1, dir2): def main(): if len(sys.argv)!=3: - print 'Usage: CompareDirs ' + print('Usage: CompareDirs ') sys.exit(-1) if compare_dirs(sys.argv[1],sys.argv[2]): - print "The directories are identical" + print("The directories are identical") sys.exit(0) else: #the part that differed is explained via dircmp.report() above - print "The directories differ" + print("The directories differ") sys.exit(1) if __name__=="__main__": diff --git a/eng/scripts/clean.py b/eng/scripts/clean.py index a1dcca92c..6dbfc95eb 100644 --- a/eng/scripts/clean.py +++ b/eng/scripts/clean.py @@ -17,7 +17,7 @@ def do_dir(dirname): if os.path.isdir(filename): do_dir(filename) elif is_binary(filename): - print 'deleting', filename + print('deleting', filename) os.remove(filename) TOP_DIR = "c:\\IronPython-0.7" diff --git a/eng/scripts/copyrights.py b/eng/scripts/copyrights.py index 3df0e8d39..243b72a91 100644 --- a/eng/scripts/copyrights.py +++ b/eng/scripts/copyrights.py @@ -51,18 +51,18 @@ def add_header(filename, old_header, new_header): text = open(filename, 'r').read() if text.startswith(old_header): - print "replacing header", filename + print("replacing header", filename) text = new_header + text[len(old_header):] open(filename, 'w').write(text) elif not text.startswith(new_header): - print 'no old header', filename + print('no old header', filename) text = new_header + "\n" + text open(filename, 'w').write(text) def do_dir(dirname): import os for file in os.listdir(dirname): - print "Processing:", file + print("Processing:", file) if file == "ExternalCode": continue filename = os.path.join(dirname, file) if os.path.isdir(filename): diff --git a/eng/scripts/make_meta1.py b/eng/scripts/make_meta1.py index 8554a80ee..24d7e359d 100644 --- a/eng/scripts/make_meta1.py +++ b/eng/scripts/make_meta1.py @@ -151,7 +151,7 @@ def __init__(self, name, super_name, methods): self.strings = {} def get_constant_string(self, s): - if not self.strings.has_key(s): + if s not in self.strings: self.strings[s] = s + "_str" return self.strings[s] @@ -235,7 +235,7 @@ def collect_methods(text): #if c.super_name != 'PyModule': # assert c.super_name == base.name, c.super_name - print c, c.methods + print(c, c.methods) code = c.make_any_methods() code.insert(0, START) code.append(END) diff --git a/eng/scripts/radix_generator.py b/eng/scripts/radix_generator.py index 5f4ea03eb..bfa8da83b 100644 --- a/eng/scripts/radix_generator.py +++ b/eng/scripts/radix_generator.py @@ -2,8 +2,8 @@ # The .NET Foundation licenses this file to you under the Apache 2.0 License. # See the LICENSE file in the project root for more information. -max_uint = 0xffffffffl -print max_uint +max_uint = 0xffffffff +print(max_uint) digits = ['0','0'] radii = ['0','0'] @@ -11,11 +11,11 @@ p = 1 while i**(p+1) <= max_uint: p = p+1 - print i, p, i**p + print(i, p, i**p) digits.append(str(p)) radii.append(str(i**p)) -print digits, radii +print(digits, radii) -print ", ".join(digits) -print ", ".join(radii) +print(", ".join(digits)) +print(", ".join(radii)) diff --git a/eng/scripts/run_compiled.py b/eng/scripts/run_compiled.py index 782420d10..8207ef7e4 100644 --- a/eng/scripts/run_compiled.py +++ b/eng/scripts/run_compiled.py @@ -8,16 +8,16 @@ def main(): if len(sys.argv) != 2: - print "Usage: ipy run_compiled.py " + print("Usage: ipy run_compiled.py ") sys.exit(-1) testName = sys.argv[1] - print "Compiling ", testName ,"..." + print("Compiling ", testName ,"...") clr.CompileModules("compiledTest.dll", testName) File.Move(testName, testName+".bak") try: - print "Running test from compiled binary..." + print("Running test from compiled binary...") clr.AddReference("compiledTest") __import__(Path.GetFileNameWithoutExtension(testName)) finally: diff --git a/eng/scripts/run_interactive.py b/eng/scripts/run_interactive.py index 1d6140577..182351176 100644 --- a/eng/scripts/run_interactive.py +++ b/eng/scripts/run_interactive.py @@ -111,24 +111,24 @@ def run_interactive_main(): if testName: testsToRun = Directory.GetFiles(Directory.GetCurrentDirectory() , testName) else: - print "No test name provided" + print("No test name provided") sys.exit(-1) allErrors = [] for test in testsToRun: try: - print "\nRunning test in interactive mode - ", test + print("\nRunning test in interactive mode - ", test) con = FileConsole(test) con.Run() - except Exception, e: - print e, e.clsException + except Exception as e: + print(e, e.clsException) allErrors.append((test, sys.exc_info()[0], sys.exc_info()[1])) if(allErrors): - print "\n##################################################################################" - print "Summary of all errors" + print("\n##################################################################################") + print("Summary of all errors") for file, type, message in allErrors: - print file, type, message + print(file, type, message) sys.exit(len(allErrors)) #-------------------------------------------------------------------------------------- diff --git a/eng/scripts/test_builder.py b/eng/scripts/test_builder.py index 2414ec955..aec44ea1a 100644 --- a/eng/scripts/test_builder.py +++ b/eng/scripts/test_builder.py @@ -6,7 +6,7 @@ import os newline = os.linesep -pats = [0L, 1L, 42L, 0x7fffffffL, 0x80000000L, 0xabcdef01L, 0xffffffffL] +pats = [0, 1, 42, 0x7fffffff, 0x80000000, 0xabcdef01, 0xffffffff] nums = [] for p0 in pats: for p1 in pats: @@ -23,7 +23,7 @@ bignums.append(n) bignums.append(-n) #!!! should add 2 or 3 larger numbers to check for any issues there -print len(bignums), len(bignums)**2 +print(len(bignums), len(bignums)**2) @@ -40,7 +40,7 @@ ] def buildit(name, nums): - print 'expected', (len(nums)**2)*len(ops) + print('expected', (len(nums)**2)*len(ops)) t0 = time.clock() for sym, op in ops: @@ -48,7 +48,7 @@ def buildit(name, nums): fp = open('%s_%s.txt' % (name, op.__name__), 'w') else: fp = None - print 'computing', sym + print('computing', sym) for x in nums: for y in nums: try: @@ -63,7 +63,7 @@ def buildit(name, nums): fp.write('ERROR' + newline) if fp: fp.close() t1 = time.clock() - print 'time', (t1-t0) + print('time', (t1-t0)) buildit('time1', bignums) buildit('short', nums)