diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2018-03-17 11:53:22 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2018-03-17 12:16:10 -0400 |
commit | 6fba91c17b264beec674bb25019e3888fe5ba305 (patch) | |
tree | 2bb0ef3b043a509d74fb0c8a8a006dd1f78291db /setuptools/package_index.py | |
parent | e141c08edc47834b04eb0fd7c1510ee04b682921 (diff) | |
download | external_python_setuptools-6fba91c17b264beec674bb25019e3888fe5ba305.tar.gz external_python_setuptools-6fba91c17b264beec674bb25019e3888fe5ba305.tar.bz2 external_python_setuptools-6fba91c17b264beec674bb25019e3888fe5ba305.zip |
Rely on stdlib to decode entities.
Diffstat (limited to 'setuptools/package_index.py')
-rwxr-xr-x | setuptools/package_index.py | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 64a11c9b..914b5e61 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -23,6 +23,7 @@ from distutils import log from distutils.errors import DistutilsError from fnmatch import translate from setuptools.py27compat import get_all_headers +from setuptools.py33compat import unescape from setuptools.wheel import Wheel EGG_FRAGMENT = re.compile(r'^egg=([-A-Za-z0-9_.+!]+)$') @@ -931,23 +932,9 @@ class PackageIndex(Environment): entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub -def uchr(c): - if not isinstance(c, int): - return c - if c > 255: - return six.unichr(c) - return chr(c) - - def decode_entity(match): what = match.group(1) - if what.startswith('#x'): - what = int(what[2:], 16) - elif what.startswith('#'): - what = int(what[1:]) - else: - what = six.moves.html_entities.name2codepoint.get(what, match.group(0)) - return uchr(what) + return unescape(what) def htmldecode(text): |