More python2 -> python3 compatibility

This commit is contained in:
rocky
2015-12-11 17:54:30 -05:00
parent d3c732298c
commit b3c8cbb83f
19 changed files with 387 additions and 286 deletions

View File

@@ -1,4 +1,6 @@
#! python
#!/usr/bin/env python
from __future__ import print_function
"""
compile_tests -- compile test patterns for the decompyle test suite
"""
@@ -20,8 +22,8 @@ for opt, val in opts:
if args:
raise 'This tool does not want any arguments'
print "Using files in dir %s" % src_dir
print "Compiling into dir %s" % work_dir
print("Using files in dir %s" % src_dir)
print("Compiling into dir %s" % work_dir)
tests = {}
@@ -46,6 +48,7 @@ tests['2.3'] = tests['2.2']
tests['2.5'] = tests['2.3']
tests['2.6'] = tests['2.5']
tests['2.7'] = ['mine'] + tests['2.6']
tests['3.4'] = ['mine']
total_tests = len(tests['2.7'])
#tests['2.2'].sort(); print tests['2.2']
@@ -62,13 +65,13 @@ def compile_for_version(version):
os.mkdir(target_dir)
for file in tests[version]:
compile(file, target_dir)
try:
version = '%i.%i' % sys.version_info[:2]
except AttributeError:
version = sys.version[:3]
print 'Compiling test files for Python', version,
print '(%i/%i files)' % (len(tests[version]), total_tests)
print('Compiling test files for Python', version)
print('(%i/%i files)' % (len(tests[version]), total_tests))
compile_for_version(version)
print 'Done.'
print('Done.')