From c177c3a5a998ae24199c773e4a37e841ebb61677 Mon Sep 17 00:00:00 2001 From: Serge Guelton Date: Wed, 19 Dec 2018 13:46:13 +0000 Subject: 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 --- clang/docs/tools/dump_ast_matchers.py | 7 +++++-- clang/docs/tools/dump_format_style.py | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'clang/docs') 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') -- cgit v1.2.3