diff options
Diffstat (limited to 'tools/scan-view/bin/scan-view')
-rwxr-xr-x | tools/scan-view/bin/scan-view | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tools/scan-view/bin/scan-view b/tools/scan-view/bin/scan-view index 6e384ec217..6165432e7a 100755 --- a/tools/scan-view/bin/scan-view +++ b/tools/scan-view/bin/scan-view @@ -1,5 +1,7 @@ #!/usr/bin/env python +from __future__ import print_function + """The clang static analyzer results viewer. """ @@ -9,7 +11,10 @@ import os import posixpath import threading import time -import urllib +try: + from urllib.request import urlopen +except ImportError: + from urllib2 import urlopen import webbrowser # How long to wait for server to start. @@ -27,7 +32,7 @@ kMaxPortsToTry = 100 def url_is_up(url): try: - o = urllib.urlopen(url) + o = urlopen(url) except IOError: return False o.close() @@ -35,7 +40,6 @@ def url_is_up(url): def start_browser(port, options): - import urllib import webbrowser url = 'http://%s:%d' % (options.host, port) @@ -52,10 +56,10 @@ def start_browser(port, options): sys.stderr.flush() time.sleep(kSleepTimeout) else: - print >> sys.stderr, 'WARNING: Unable to detect that server started.' + print('WARNING: Unable to detect that server started.', file=sys.stderr) if options.debug: - print >> sys.stderr, '%s: Starting webbrowser...' % sys.argv[0] + print('%s: Starting webbrowser...' % sys.argv[0], file=sys.stderr) webbrowser.open(url) @@ -69,9 +73,9 @@ def run(port, options, root): import ScanView try: - print 'Starting scan-view at: http://%s:%d' % (options.host, - port) - print ' Use Ctrl-C to exit.' + print('Starting scan-view at: http://%s:%d' % (options.host, + port)) + print(' Use Ctrl-C to exit.') httpd = ScanView.create_server((options.host, port), options, root) httpd.serve_forever() |