<div dir="ltr">On Wed, Aug 7, 2013 at 8:53 AM, Eli Bendersky <span dir="ltr"><<a href="mailto:eliben@google.com" target="_blank">eliben@google.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Daniel,<div><br></div><div>Thanks for cleaning up Lit! How about 'from __future__ import print_function' -- or haven't 2.6+ been decided yet?</div>
</div></blockquote><div><br></div><div>Yeah, I was trying to not change the python compatibility (although I've only been testing against 2.5). It was easy enough to do, at least for the stuff so far.</div><div><br></div>
<div> - Daniel</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class="HOEnZb"><font color="#888888"><div><br></div><div>Eli</div>
</font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Aug 6, 2013 at 8:18 PM, Daniel Dunbar <span dir="ltr"><<a href="mailto:daniel@zuster.org" target="_blank">daniel@zuster.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: ddunbar<br>
Date: Tue Aug 6 22:18:36 2013<br>
New Revision: 187856<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=187856&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=187856&view=rev</a><br>
Log:<br>
[lit] Use dual-compatible print() syntax where possible.<br>
<br>
Modified:<br>
llvm/trunk/utils/lit/lit/Util.py<br>
llvm/trunk/utils/lit/lit/main.py<br>
<br>
Modified: llvm/trunk/utils/lit/lit/Util.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/Util.py?rev=187856&r1=187855&r2=187856&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/Util.py?rev=187856&r1=187855&r2=187856&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/utils/lit/lit/Util.py (original)<br>
+++ llvm/trunk/utils/lit/lit/Util.py Tue Aug 6 22:18:36 2013<br>
@@ -116,27 +116,25 @@ def printHistogram(items, title = 'Items<br>
<br>
barW = 40<br>
hr = '-' * (barW + 34)<br>
- print '\nSlowest %s:' % title<br>
- print hr<br>
+ print('\nSlowest %s:' % title)<br>
+ print(hr)<br>
for name,value in items[-20:]:<br>
- print '%.2fs: %s' % (value, name)<br>
- print '\n%s Times:' % title<br>
- print hr<br>
+ print('%.2fs: %s' % (value, name))<br>
+ print('\n%s Times:' % title)<br>
+ print(hr)<br>
pDigits = int(math.ceil(math.log(maxValue, 10)))<br>
pfDigits = max(0, 3-pDigits)<br>
if pfDigits:<br>
pDigits += pfDigits + 1<br>
cDigits = int(math.ceil(math.log(len(items), 10)))<br>
- print "[%s] :: [%s] :: [%s]" % ('Range'.center((pDigits+1)*2 + 3),<br>
+ print("[%s] :: [%s] :: [%s]" % ('Range'.center((pDigits+1)*2 + 3),<br>
'Percentage'.center(barW),<br>
- 'Count'.center(cDigits*2 + 1))<br>
- print hr<br>
+ 'Count'.center(cDigits*2 + 1)))<br>
+ print(hr)<br>
for i,row in enumerate(histo):<br>
pct = float(len(row)) / len(items)<br>
w = int(barW * pct)<br>
- print "[%*.*fs,%*.*fs)" % (pDigits, pfDigits, i*barH,<br>
- pDigits, pfDigits, (i+1)*barH),<br>
- print ":: [%s%s] :: [%*d/%*d]" % ('*'*w, ' '*(barW-w),<br>
- cDigits, len(row),<br>
- cDigits, len(items))<br>
+ print("[%*.*fs,%*.*fs) :: [%s%s] :: [%*d/%*d]" % (<br>
+ pDigits, pfDigits, i*barH, pDigits, pfDigits, (i+1)*barH,<br>
+ '*'*w, ' '*(barW-w), cDigits, len(row), cDigits, len(items)))<br>
<br>
<br>
Modified: llvm/trunk/utils/lit/lit/main.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/main.py?rev=187856&r1=187855&r2=187856&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/main.py?rev=187856&r1=187855&r2=187856&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/utils/lit/lit/main.py (original)<br>
+++ llvm/trunk/utils/lit/lit/main.py Tue Aug 6 22:18:36 2013<br>
@@ -59,14 +59,14 @@ class TestingProgressDisplay:<br>
if self.progressBar:<br>
self.progressBar.clear()<br>
<br>
- print '%s: %s (%d of %d)' % (<a href="http://test.result.name" target="_blank">test.result.name</a>, test.getFullName(),<br>
- self.completed, self.numTests)<br>
+ print('%s: %s (%d of %d)' % (<a href="http://test.result.name" target="_blank">test.result.name</a>, test.getFullName(),<br>
+ self.completed, self.numTests))<br>
<br>
if test.result.isFailure and self.opts.showOutput:<br>
- print "%s TEST '%s' FAILED %s" % ('*'*20, test.getFullName(),<br>
- '*'*20)<br>
- print test.output<br>
- print "*" * 20<br>
+ print("%s TEST '%s' FAILED %s" % ('*'*20, test.getFullName(),<br>
+ '*'*20))<br>
+ print(test.output)<br>
+ print("*" * 20)<br>
<br>
sys.stdout.flush()<br>
<br>
@@ -125,7 +125,7 @@ class Tester(threading.Thread):<br>
except KeyboardInterrupt:<br>
# This is a sad hack. Unfortunately subprocess goes<br>
# bonkers with ctrl-c and we start forking merrily.<br>
- print '\nCtrl-C detected, goodbye.'<br>
+ print('\nCtrl-C detected, goodbye.')<br>
os.kill(0,9)<br>
except:<br>
if self.litConfig.debug:<br>
@@ -299,19 +299,19 @@ def main(builtinParameters = {}):<br>
<br>
# Show the suites, if requested.<br>
if opts.showSuites:<br>
- print '-- Test Suites --'<br>
+ print('-- Test Suites --')<br>
for ts,ts_tests in suitesAndTests:<br>
- print ' %s - %d tests' %(<a href="http://ts.name" target="_blank">ts.name</a>, len(ts_tests))<br>
- print ' Source Root: %s' % ts.source_root<br>
- print ' Exec Root : %s' % ts.exec_root<br>
+ print(' %s - %d tests' %(<a href="http://ts.name" target="_blank">ts.name</a>, len(ts_tests)))<br>
+ print(' Source Root: %s' % ts.source_root)<br>
+ print(' Exec Root : %s' % ts.exec_root)<br>
<br>
# Show the tests, if requested.<br>
if opts.showTests:<br>
- print '-- Available Tests --'<br>
+ print('-- Available Tests --')<br>
for ts,ts_tests in suitesAndTests:<br>
ts_tests.sort(key = lambda test: test.path_in_suite)<br>
for test in ts_tests:<br>
- print ' %s' % (test.getFullName(),)<br>
+ print(' %s' % (test.getFullName(),))<br>
<br>
# Select and order the tests.<br>
numTotalTests = len(tests)<br>
@@ -357,10 +357,10 @@ def main(builtinParameters = {}):<br>
tc = ProgressBar.TerminalController()<br>
progressBar = ProgressBar.ProgressBar(tc, header)<br>
except ValueError:<br>
- print header<br>
+ print(header)<br>
progressBar = ProgressBar.SimpleProgressBar('Testing: ')<br>
else:<br>
- print header<br>
+ print(header)<br>
<br>
startTime = time.time()<br>
display = TestingProgressDisplay(opts, len(tests), progressBar)<br>
@@ -380,7 +380,7 @@ def main(builtinParameters = {}):<br>
display.finish()<br>
<br>
if not opts.quiet:<br>
- print 'Testing Time: %.2fs'%(time.time() - startTime)<br>
+ print('Testing Time: %.2fs'%(time.time() - startTime))<br>
<br>
# Update results for any tests which weren't run.<br>
for t in tests:<br>
@@ -403,10 +403,10 @@ def main(builtinParameters = {}):<br>
elts = byCode.get(code)<br>
if not elts:<br>
continue<br>
- print '*'*20<br>
- print '%s (%d):' % (title, len(elts))<br>
+ print('*'*20)<br>
+ print('%s (%d):' % (title, len(elts)))<br>
for t in elts:<br>
- print ' %s' % t.getFullName()<br>
+ print(' %s' % t.getFullName())<br>
print<br>
<br>
if opts.timeTests:<br>
@@ -431,7 +431,7 @@ def main(builtinParameters = {}):<br>
continue<br>
N = len(byCode.get(code,[]))<br>
if N:<br>
- print ' %s: %d' % (name,N)<br>
+ print(' %s: %d' % (name,N))<br>
<br>
# If we encountered any additional errors, exit abnormally.<br>
if litConfig.numErrors:<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>