mirror of
https://github.com/python/cpython.git
synced 2025-07-12 05:45:15 +00:00
Convert print statements to function calls in Tools/.
This commit is contained in:
parent
e5d0e8431f
commit
6afaeb757a
66 changed files with 777 additions and 779 deletions
|
@ -131,7 +131,7 @@ def hexrepr(t, precision=4):
|
|||
return '(' + ', '.join(['0x%0*X' % (precision, item)
|
||||
for item in t]) + ')'
|
||||
except TypeError as why:
|
||||
print '* failed to convert %r: %s' % (t, why)
|
||||
print('* failed to convert %r: %s' % (t, why))
|
||||
raise
|
||||
|
||||
def python_mapdef_code(varname, map, comments=1, precisions=(2, 4)):
|
||||
|
@ -383,18 +383,18 @@ def convertdir(dir, dirprefix='', nameprefix='', comments=1):
|
|||
name = nameprefix + name
|
||||
codefile = name + '.py'
|
||||
marshalfile = name + '.mapping'
|
||||
print 'converting %s to %s and %s' % (mapname,
|
||||
print('converting %s to %s and %s' % (mapname,
|
||||
dirprefix + codefile,
|
||||
dirprefix + marshalfile)
|
||||
dirprefix + marshalfile))
|
||||
try:
|
||||
map = readmap(os.path.join(dir,mapname))
|
||||
if not map:
|
||||
print '* map is empty; skipping'
|
||||
print('* map is empty; skipping')
|
||||
else:
|
||||
pymap(mappathname, map, dirprefix + codefile,name,comments)
|
||||
marshalmap(mappathname, map, dirprefix + marshalfile)
|
||||
except ValueError as why:
|
||||
print '* conversion failed: %s' % why
|
||||
print('* conversion failed: %s' % why)
|
||||
raise
|
||||
|
||||
def rewritepythondir(dir, dirprefix='', comments=1):
|
||||
|
@ -405,17 +405,17 @@ def rewritepythondir(dir, dirprefix='', comments=1):
|
|||
continue
|
||||
name = mapname[:-len('.mapping')]
|
||||
codefile = name + '.py'
|
||||
print 'converting %s to %s' % (mapname,
|
||||
dirprefix + codefile)
|
||||
print('converting %s to %s' % (mapname,
|
||||
dirprefix + codefile))
|
||||
try:
|
||||
map = marshal.load(open(os.path.join(dir,mapname),
|
||||
'rb'))
|
||||
if not map:
|
||||
print '* map is empty; skipping'
|
||||
print('* map is empty; skipping')
|
||||
else:
|
||||
pymap(mapname, map, dirprefix + codefile,name,comments)
|
||||
except ValueError as why:
|
||||
print '* conversion failed: %s' % why
|
||||
print('* conversion failed: %s' % why)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue