]> granicus.if.org Git - clang/commitdiff
Portable Python script across Python version
authorSerge Guelton <sguelton@quarkslab.com>
Tue, 18 Dec 2018 16:07:37 +0000 (16:07 +0000)
committerSerge Guelton <sguelton@quarkslab.com>
Tue, 18 Dec 2018 16:07:37 +0000 (16:07 +0000)
Make scripts more future-proof by importing most __future__ stuff.

Differential Revision: https://reviews.llvm.org/D55208

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349504 91177308-0d34-0410-b5e6-96231b3b80d8

23 files changed:
bindings/python/clang/cindex.py
docs/conf.py
tools/clang-format/clang-format-diff.py
tools/clang-format/clang-format-sublime.py
tools/clang-format/clang-format.py
tools/clang-format/git-clang-format
tools/clang-rename/clang-rename.py
tools/scan-build-py/libscanbuild/arguments.py
utils/ABITest/ABITestGen.py
utils/ABITest/Enumeration.py
utils/CIndex/completion_logger_server.py
utils/TestUtils/deep-stack.py
utils/analyzer/SATestAdd.py
utils/analyzer/SATestUpdateDiffs.py
utils/analyzer/SumTimerInfo.py
utils/check_cfc/check_cfc.py
utils/check_cfc/obj_diff.py
utils/check_cfc/setup.py
utils/clangdiag.py
utils/hmaptool/hmaptool
utils/modfuzz.py
utils/perf-training/perf-helper.py
utils/token-delta.py

index 5dbe809af9f86d0ae7b43d392f7a91fd62915e93..54514b8daefa651c1819a7177bbb40ed5fc4254d 100644 (file)
@@ -44,7 +44,7 @@ The major indexing objects are:
 Most object information is exposed using properties, when the underlying API
 call is efficient.
 """
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 
 # TODO
 # ====
index a18ce3a3042185e8ef6241fdf6af2bd7fb94e9ec..19113d0d5a70fb078c3767675786ac4879ce1dbe 100644 (file)
@@ -11,7 +11,7 @@
 # All configuration values have a default; values that are commented out
 # serve to show the default.
 
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 import sys, os
 from datetime import date
 
index 1721d8a4308d9cd0a7b5c7cc4c1d412692580211..54347ce7593a665fe6b5e571501467d57adb1a0d 100755 (executable)
@@ -21,7 +21,7 @@ Example usage for git/svn users:
   svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
 
 """
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 
 import argparse
 import difflib
index 16ff56e502c66f71c1cbeb06c49cdbd50a8fc6df..5ea9a27825cbef1dc004139e5ec5c986a1cfa829 100644 (file)
@@ -12,7 +12,7 @@
 # It operates on the current, potentially unsaved buffer and does not create
 # or save any files. To revert a formatting, just undo.
 
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 import sublime
 import sublime_plugin
 import subprocess
index 5fe592a9202bc50cf4193f016564270cec565df2..fe068bd41c18bf8844aa678d9a589d3b1a3c8bb9 100644 (file)
@@ -25,7 +25,7 @@
 #
 # It operates on the current, potentially unsaved buffer and does not create
 # or save any files. To revert a formatting, just undo.
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 
 import difflib
 import json
index 0b2103962a31e8a04e7b44b1116e874034396ac1..96e3b4e8a2c11a9ae5758471dfd202c46674d05e 100755 (executable)
@@ -23,7 +23,7 @@ git clang-format -h
 Requires Python 2.7 or Python 3                                                  
 """               
 
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 import argparse
 import collections
 import contextlib
index 0cb8a26d27fc5a9c059b1347f77e1f689c15e787..3381c5267f1c0416cffb99700d21f944c89b3bcc 100644 (file)
@@ -22,7 +22,7 @@ you would like to rename and press '<leader>cr'. You will be prompted for a new
 name if the cursor points to a valid symbol.
 '''
 
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 import vim
 import subprocess
 import sys
index 73a7f24e679e153fdcf187de54335a5947c47fed..eb8ea0d9fffd09f0d40dde7cecd89e5764d33595 100644 (file)
@@ -12,7 +12,7 @@ earlier.)
 It also implements basic validation methods, related to the command.
 Validations are mostly calling specific help methods, or mangling values.
 """
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 
 import os
 import sys
index a829f925dfb2f44cafe784f86dad8d07f3d03163..93a6de93068d466b33174f58e6d343c7e11c2d9a 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 from pprint import pprint
 import random, atexit, time
 from random import randrange
index 76067243d13527ff5298e3513511b26ed632bd6c..24f5b5fba24cd48c2e506ea6b606e9b84f3db8ce 100644 (file)
@@ -1,6 +1,6 @@
 """Utilities for enumeration of finite and countably infinite sets.
 """
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 ###
 # Countable iteration
 
index 818d10d73b2061db2fcb162534ad2de7ffec0361..201667117fc2f96976d25b872915d990657f8472 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 import sys
 from socket import *
 from time import strftime
index 8636efabec0e9940cc337b55dde3fb301687d306..10bf47acb1f777a5b048402d7447a0e7b7b94c79 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 def pcall(f, N):
     if N == 0:
         print('    f(0)', file=f)
index 377897e143db61ee234a38050962cfa6d297b404..52089f4e0660e5bbe271e9ea264b54b3193bf844 100755 (executable)
@@ -42,7 +42,7 @@ the Repository Directory.
                                           diff -ur CachedSource PatchedSource \
                                               > changes_for_analyzer.patch
 """
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 import SATestBuild
 
 import os
index 64e6ca43db30fd827927092efb60747abb395605..ea3c08cc210c423192081dc2b06bcb7b94ada4c8 100755 (executable)
@@ -3,7 +3,7 @@
 """
 Update reference results for static analyzer.
 """
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 
 import SATestBuild
 
index b3219b00c7bbe2bba55d57dab5eb2745c0fa413f..36e519adbf71c482c7174ee101a94b3a07bda8ed 100644 (file)
@@ -6,7 +6,7 @@ Script to Summarize statistics in the scan-build output.
 Statistics are enabled by passing '-internal-stats' option to scan-build
 (or '-analyzer-stats' to the analyzer).
 """
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 
 import sys
 
index aea9bdd6388adef25bfac1685b5c2689509adf13..4ad88c8b751d6d9642ae45bdd8d677976d03a08f 100755 (executable)
@@ -47,7 +47,7 @@ To add a new check:
  subclass.
 """
 
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 
 import imp
 import os
index 61b9118df837b82f2fbc197380cd89ab6380b28e..1302834432a9dde01291377e6ef64e8ef28ca810 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python2.7
 
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 
 import argparse
 import difflib
index 6005f6f41125523b27c467aa74b965cf6af172b0..64f07d5dcc52a17ffd07f6797e967e9795037995 100644 (file)
@@ -1,7 +1,7 @@
 """For use on Windows. Run with:
     python.exe setup.py py2exe
     """
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 from distutils.core import setup
 try:
     import py2exe
index a9656c55d8b8fa3d24bbde4ac988abe60464fa78..6baf65a8761c36151341bf828f9a25ffd7b3a393 100755 (executable)
@@ -9,7 +9,7 @@
 #   (lldb) command script import /path/to/clandiag.py
 #----------------------------------------------------------------------
 
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 import lldb
 import argparse
 import shlex
index 2b1ca7436c3fc487823299ecb77e410723ffd64b..58baab2f7746c19a524d843843b1e813bbc1bc0a 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 
 import json
 import optparse
index 4dc25e846963b7911b5f43d08e5e356bf7ff9b80..61ca3272aca561c04b27d982fb94ba8791f6e81b 100644 (file)
@@ -4,7 +4,7 @@
 #  1) Update the 'decls' list below with your fuzzing configuration.
 #  2) Run with the clang binary as the command-line argument.
 
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 import random
 import subprocess
 import sys
index 6337a9b19ad4ecb7711e8c7387e18e954f9c7c69..72b4b4e5a0ca3253ab45c7f970b1914ef2f41078 100644 (file)
@@ -7,7 +7,7 @@
 #
 #===------------------------------------------------------------------------===#
 
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 
 import sys
 import os
index 9fc5646bb77fc0512b0f7998e69bd9a9aac5c5d6..62b4eb3c776c374d634a8ab977a4aa0b787b6b01 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
 import os
 import re
 import subprocess