diff options
author | Serge Guelton <sguelton@quarkslab.com> | 2018-12-18 08:36:33 +0000 |
---|---|---|
committer | Serge Guelton <sguelton@quarkslab.com> | 2018-12-18 08:36:33 +0000 |
commit | 4f672fc63af4f838531fa8b85152024c037ccea3 (patch) | |
tree | 5c6b4ebdcc16a64425627d6caaa4bf3bff622f65 /docs | |
parent | 69150282888f67763b847e6d1c2709f4c272abaa (diff) |
Portable Python script across Python version
Using from __future__ import print_function it is possible to have a compatible behavior of `print(...)` across Python version.
Differential Revision: https://reviews.llvm.org/D55213
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r-- | docs/conf.py | 9 | ||||
-rwxr-xr-x | docs/tools/dump_ast_matchers.py | 8 |
2 files changed, 9 insertions, 8 deletions
diff --git a/docs/conf.py b/docs/conf.py index dc69f8a848..a18ce3a304 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,6 +11,7 @@ # All configuration values have a default; values that are commented out # serve to show the default. +from __future__ import print_function import sys, os from datetime import date @@ -233,14 +234,14 @@ for name in os.listdir(command_guide_path): header = f.readline().rstrip('\n') if len(header) != len(title): - print >>sys.stderr, ( + print(( "error: invalid header in %r (does not match title)" % ( - file_subpath,)) + file_subpath,)), file=sys.stderr) if ' - ' not in title: - print >>sys.stderr, ( + print(( ("error: invalid title in %r " "(expected '<name> - <description>')") % ( - file_subpath,)) + file_subpath,)), file=sys.stderr) # Split the name out of the title. name,description = title.split(' - ', 1) diff --git a/docs/tools/dump_ast_matchers.py b/docs/tools/dump_ast_matchers.py index 2c0cbafa8a..cae27b20a9 100755 --- a/docs/tools/dump_ast_matchers.py +++ b/docs/tools/dump_ast_matchers.py @@ -41,7 +41,7 @@ def esc(text): url = 'https://clang.llvm.org/doxygen/classclang_1_1%s.html' % name if url not in doxygen_probes: try: - print 'Probing %s...' % url + print('Probing %s...' % url) urllib2.urlopen(url) doxygen_probes[url] = True except: @@ -307,14 +307,14 @@ def act_on_decl(declaration, comment, allowed_types): if not result_types: if not comment: # Only overloads don't have their own doxygen comments; ignore those. - print 'Ignoring "%s"' % name + print('Ignoring "%s"' % name) else: - print 'Cannot determine result type for "%s"' % name + print('Cannot determine result type for "%s"' % name) else: for result_type in result_types: add_matcher(result_type, name, args, comment) else: - print '*** Unparsable: "' + declaration + '" ***' + print('*** Unparsable: "' + declaration + '" ***') def sort_table(matcher_type, matcher_map): """Returns the sorted html table for the given row map.""" |