aboutsummaryrefslogtreecommitdiff
path: root/clang/docs
diff options
context:
space:
mode:
authorSerge Guelton <sguelton@quarkslab.com>2018-12-19 13:46:13 +0000
committerSerge Guelton <sguelton@quarkslab.com>2018-12-19 13:46:13 +0000
commitc177c3a5a998ae24199c773e4a37e841ebb61677 (patch)
treef266024d3d5c2e11a7778ac88b1a3b01af48ba0d /clang/docs
parente2a27b3f76f4249df786aa5b5fa0006a7f8c05a4 (diff)
Portable Python script across Python version
urllib2 as been renamed into urllib and the library layout has changed. Workaround that in a consistent manner. Differential Revision: https://reviews.llvm.org/D55199 llvm-svn: 349627
Diffstat (limited to 'clang/docs')
-rwxr-xr-xclang/docs/tools/dump_ast_matchers.py7
-rwxr-xr-xclang/docs/tools/dump_format_style.py1
2 files changed, 5 insertions, 3 deletions
diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py
index cae27b20a970..c96c1ca27acb 100755
--- a/clang/docs/tools/dump_ast_matchers.py
+++ b/clang/docs/tools/dump_ast_matchers.py
@@ -5,7 +5,10 @@
import collections
import re
-import urllib2
+try:
+ from urllib.request import urlopen
+except ImportError:
+ from urllib2 import urlopen
MATCHERS_FILE = '../../include/clang/ASTMatchers/ASTMatchers.h'
@@ -42,7 +45,7 @@ def esc(text):
if url not in doxygen_probes:
try:
print('Probing %s...' % url)
- urllib2.urlopen(url)
+ urlopen(url)
doxygen_probes[url] = True
except:
doxygen_probes[url] = False
diff --git a/clang/docs/tools/dump_format_style.py b/clang/docs/tools/dump_format_style.py
index f2682edc7773..5feb793a4d70 100755
--- a/clang/docs/tools/dump_format_style.py
+++ b/clang/docs/tools/dump_format_style.py
@@ -6,7 +6,6 @@
import collections
import os
import re
-import urllib2
CLANG_DIR = os.path.join(os.path.dirname(__file__), '../..')
FORMAT_STYLE_FILE = os.path.join(CLANG_DIR, 'include/clang/Format/Format.h')