From: Serge Guelton Date: Thu, 3 Jan 2019 14:12:44 +0000 (+0000) Subject: Python compat - urllib X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9f3acd1159de6da53e8611c237b72933f1115188;p=llvm Python compat - urllib Differential Revision: https://reviews.llvm.org/D56261 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350315 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/unicode-case-fold.py b/utils/unicode-case-fold.py index 2efa9045074..ad8265ba7bc 100755 --- a/utils/unicode-case-fold.py +++ b/utils/unicode-case-fold.py @@ -21,7 +21,11 @@ from __future__ import print_function import sys import re -import urllib2 +try: + from urllib.request import urlopen +except ImportError: + from urllib2 import urlopen + # This variable will body of the mappings function body = "" @@ -95,7 +99,7 @@ def dump_block(b): body += pattern.format(last, stride(b), modulo, shift(b[0])) current_block = [] -f = urllib2.urlopen(sys.argv[1]) +f = urlopen(sys.argv[1]) for m in mappings(f): if len(current_block) == 0: current_block.append(m)