aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Guelton <sguelton@quarkslab.com>2018-12-18 16:07:37 +0000
committerSerge Guelton <sguelton@quarkslab.com>2018-12-18 16:07:37 +0000
commitb748c0e696602cd8371c875a3eb337b8b221800d (patch)
treeda9858e64a96816d776181b2d865e5f46cbce5e2
parent3ee1ffc9fcb09dcfbcb6b84e19c9855eae8cafa2 (diff)
Portable Python script across Python version
Make scripts more future-proof by importing most __future__ stuff. Differential Revision: https://reviews.llvm.org/D55208 llvm-svn: 349504
-rw-r--r--clang/bindings/python/clang/cindex.py2
-rw-r--r--clang/docs/conf.py2
-rwxr-xr-xclang/tools/clang-format/clang-format-diff.py2
-rw-r--r--clang/tools/clang-format/clang-format-sublime.py2
-rw-r--r--clang/tools/clang-format/clang-format.py2
-rwxr-xr-xclang/tools/clang-format/git-clang-format2
-rw-r--r--clang/tools/clang-rename/clang-rename.py2
-rw-r--r--clang/tools/scan-build-py/libscanbuild/arguments.py2
-rwxr-xr-xclang/utils/ABITest/ABITestGen.py2
-rw-r--r--clang/utils/ABITest/Enumeration.py2
-rwxr-xr-xclang/utils/CIndex/completion_logger_server.py2
-rwxr-xr-xclang/utils/TestUtils/deep-stack.py2
-rwxr-xr-xclang/utils/analyzer/SATestAdd.py2
-rwxr-xr-xclang/utils/analyzer/SATestUpdateDiffs.py2
-rw-r--r--clang/utils/analyzer/SumTimerInfo.py2
-rwxr-xr-xclang/utils/check_cfc/check_cfc.py2
-rwxr-xr-xclang/utils/check_cfc/obj_diff.py2
-rw-r--r--clang/utils/check_cfc/setup.py2
-rwxr-xr-xclang/utils/clangdiag.py2
-rwxr-xr-xclang/utils/hmaptool/hmaptool2
-rw-r--r--clang/utils/modfuzz.py2
-rw-r--r--clang/utils/perf-training/perf-helper.py2
-rwxr-xr-xclang/utils/token-delta.py2
23 files changed, 23 insertions, 23 deletions
diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py
index 5dbe809af9f8..54514b8daefa 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -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
# ====
diff --git a/clang/docs/conf.py b/clang/docs/conf.py
index a18ce3a30421..19113d0d5a70 100644
--- a/clang/docs/conf.py
+++ b/clang/docs/conf.py
@@ -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
diff --git a/clang/tools/clang-format/clang-format-diff.py b/clang/tools/clang-format/clang-format-diff.py
index 1721d8a4308d..54347ce7593a 100755
--- a/clang/tools/clang-format/clang-format-diff.py
+++ b/clang/tools/clang-format/clang-format-diff.py
@@ -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
diff --git a/clang/tools/clang-format/clang-format-sublime.py b/clang/tools/clang-format/clang-format-sublime.py
index 16ff56e502c6..5ea9a27825cb 100644
--- a/clang/tools/clang-format/clang-format-sublime.py
+++ b/clang/tools/clang-format/clang-format-sublime.py
@@ -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
diff --git a/clang/tools/clang-format/clang-format.py b/clang/tools/clang-format/clang-format.py
index 5fe592a9202b..fe068bd41c18 100644
--- a/clang/tools/clang-format/clang-format.py
+++ b/clang/tools/clang-format/clang-format.py
@@ -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
diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format
index 0b2103962a31..96e3b4e8a2c1 100755
--- a/clang/tools/clang-format/git-clang-format
+++ b/clang/tools/clang-format/git-clang-format
@@ -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
diff --git a/clang/tools/clang-rename/clang-rename.py b/clang/tools/clang-rename/clang-rename.py
index 0cb8a26d27fc..3381c5267f1c 100644
--- a/clang/tools/clang-rename/clang-rename.py
+++ b/clang/tools/clang-rename/clang-rename.py
@@ -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
diff --git a/clang/tools/scan-build-py/libscanbuild/arguments.py b/clang/tools/scan-build-py/libscanbuild/arguments.py
index 73a7f24e679e..eb8ea0d9fffd 100644
--- a/clang/tools/scan-build-py/libscanbuild/arguments.py
+++ b/clang/tools/scan-build-py/libscanbuild/arguments.py
@@ -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
diff --git a/clang/utils/ABITest/ABITestGen.py b/clang/utils/ABITest/ABITestGen.py
index a829f925dfb2..93a6de93068d 100755
--- a/clang/utils/ABITest/ABITestGen.py
+++ b/clang/utils/ABITest/ABITestGen.py
@@ -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
diff --git a/clang/utils/ABITest/Enumeration.py b/clang/utils/ABITest/Enumeration.py
index 76067243d135..24f5b5fba24c 100644
--- a/clang/utils/ABITest/Enumeration.py
+++ b/clang/utils/ABITest/Enumeration.py
@@ -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
diff --git a/clang/utils/CIndex/completion_logger_server.py b/clang/utils/CIndex/completion_logger_server.py
index 818d10d73b20..201667117fc2 100755
--- a/clang/utils/CIndex/completion_logger_server.py
+++ b/clang/utils/CIndex/completion_logger_server.py
@@ -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
diff --git a/clang/utils/TestUtils/deep-stack.py b/clang/utils/TestUtils/deep-stack.py
index 8636efabec0e..10bf47acb1f7 100755
--- a/clang/utils/TestUtils/deep-stack.py
+++ b/clang/utils/TestUtils/deep-stack.py
@@ -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)
diff --git a/clang/utils/analyzer/SATestAdd.py b/clang/utils/analyzer/SATestAdd.py
index 377897e143db..52089f4e0660 100755
--- a/clang/utils/analyzer/SATestAdd.py
+++ b/clang/utils/analyzer/SATestAdd.py
@@ -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
diff --git a/clang/utils/analyzer/SATestUpdateDiffs.py b/clang/utils/analyzer/SATestUpdateDiffs.py
index 64e6ca43db30..ea3c08cc210c 100755
--- a/clang/utils/analyzer/SATestUpdateDiffs.py
+++ b/clang/utils/analyzer/SATestUpdateDiffs.py
@@ -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
diff --git a/clang/utils/analyzer/SumTimerInfo.py b/clang/utils/analyzer/SumTimerInfo.py
index b3219b00c7bb..36e519adbf71 100644
--- a/clang/utils/analyzer/SumTimerInfo.py
+++ b/clang/utils/analyzer/SumTimerInfo.py
@@ -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
diff --git a/clang/utils/check_cfc/check_cfc.py b/clang/utils/check_cfc/check_cfc.py
index aea9bdd6388a..4ad88c8b751d 100755
--- a/clang/utils/check_cfc/check_cfc.py
+++ b/clang/utils/check_cfc/check_cfc.py
@@ -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
diff --git a/clang/utils/check_cfc/obj_diff.py b/clang/utils/check_cfc/obj_diff.py
index 61b9118df837..1302834432a9 100755
--- a/clang/utils/check_cfc/obj_diff.py
+++ b/clang/utils/check_cfc/obj_diff.py
@@ -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
diff --git a/clang/utils/check_cfc/setup.py b/clang/utils/check_cfc/setup.py
index 6005f6f41125..64f07d5dcc52 100644
--- a/clang/utils/check_cfc/setup.py
+++ b/clang/utils/check_cfc/setup.py
@@ -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
diff --git a/clang/utils/clangdiag.py b/clang/utils/clangdiag.py
index a9656c55d8b8..6baf65a8761c 100755
--- a/clang/utils/clangdiag.py
+++ b/clang/utils/clangdiag.py
@@ -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
diff --git a/clang/utils/hmaptool/hmaptool b/clang/utils/hmaptool/hmaptool
index 2b1ca7436c3f..58baab2f7746 100755
--- a/clang/utils/hmaptool/hmaptool
+++ b/clang/utils/hmaptool/hmaptool
@@ -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
diff --git a/clang/utils/modfuzz.py b/clang/utils/modfuzz.py
index 4dc25e846963..61ca3272aca5 100644
--- a/clang/utils/modfuzz.py
+++ b/clang/utils/modfuzz.py
@@ -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
diff --git a/clang/utils/perf-training/perf-helper.py b/clang/utils/perf-training/perf-helper.py
index 6337a9b19ad4..72b4b4e5a0ca 100644
--- a/clang/utils/perf-training/perf-helper.py
+++ b/clang/utils/perf-training/perf-helper.py
@@ -7,7 +7,7 @@
#
#===------------------------------------------------------------------------===#
-from __future__ import print_function
+from __future__ import absolute_import, division, print_function
import sys
import os
diff --git a/clang/utils/token-delta.py b/clang/utils/token-delta.py
index 9fc5646bb77f..62b4eb3c776c 100755
--- a/clang/utils/token-delta.py
+++ b/clang/utils/token-delta.py
@@ -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