diff options
author | Georg Brandl <georg@python.org> | 2014-01-18 16:44:49 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-01-18 16:44:49 +0100 |
commit | 97703d63f39e6086d497a6a749c9eee3293dcbeb (patch) | |
tree | c970bf2a7bc17aa7053f3621e299a01fb9695342 /pygments/lexers/_phpbuiltins.py | |
parent | 5500fd3a6d0c5ece01826606fcf2d684407b9cc6 (diff) | |
download | pygments-97703d63f39e6086d497a6a749c9eee3293dcbeb.tar.gz |
Finalize single-source port for Py2.[67] and Py3.3+.
Diffstat (limited to 'pygments/lexers/_phpbuiltins.py')
-rw-r--r-- | pygments/lexers/_phpbuiltins.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pygments/lexers/_phpbuiltins.py b/pygments/lexers/_phpbuiltins.py index 366a0f30..2f5ec851 100644 --- a/pygments/lexers/_phpbuiltins.py +++ b/pygments/lexers/_phpbuiltins.py @@ -3712,7 +3712,10 @@ if __name__ == '__main__': import re import shutil import tarfile - import urllib + try: + from urllib import urlretrieve + except ImportError: + from urllib.request import urlretrieve PHP_MANUAL_URL = 'http://us3.php.net/distributions/manual/php_manual_en.tar.gz' PHP_MANUAL_DIR = './php-chunked-xhtml/' @@ -3753,7 +3756,7 @@ if __name__ == '__main__': return modules def get_php_references(): - download = urllib.urlretrieve(PHP_MANUAL_URL) + download = urlretrieve(PHP_MANUAL_URL) tar = tarfile.open(download[0]) tar.extractall() tar.close() @@ -3780,7 +3783,7 @@ if __name__ == '__main__': def run(): print('>> Downloading Function Index') modules = get_php_functions() - total = sum(len(v) for v in modules.itervalues()) + total = sum(len(v) for v in modules.values()) print('%d functions found' % total) regenerate(__file__, modules) shutil.rmtree(PHP_MANUAL_DIR) |