4343from distutils .dist import Distribution
4444
4545import setupext
46- from setupext import print_line , print_raw , print_message , print_status
46+ from setupext import (print_line , print_raw , print_message , print_status ,
47+ download_or_cache )
4748
4849# Get the version from versioneer
4950import versioneer
@@ -121,6 +122,7 @@ def _download_jquery_to(dest):
121122 # Note: When bumping the jquery-ui version, also update the versions in
122123 # single_figure.html and all_figures.html.
123124 url = "https://jqueryui.com/resources/download/jquery-ui-1.12.1.zip"
125+ sha = 'f8233674366ab36b2c34c577ec77a3d70cac75d2e387d8587f3836345c0f624d'
124126 if not os .path .exists (os .path .join (dest , "jquery-ui-1.12.1" )):
125127 try :
126128 os .makedirs (dest )
@@ -130,10 +132,9 @@ def _download_jquery_to(dest):
130132 # jQueryUI's website blocks direct downloads from urllib.request's
131133 # default User-Agent, but not (for example) wget; so I don't feel too
132134 # bad passing in an empty User-Agent.
133- with urllib .request .urlopen (
134- urllib .request .Request (url , headers = {"User-Agent" : "" })) \
135- as req :
136- ZipFile (BytesIO (req .read ())).extractall (dest )
135+ buff = download_or_cache (url , sha )
136+ with ZipFile (buff ) as zf :
137+ zf .extractall (dest )
137138
138139
139140# Relying on versioneer's implementation detail.
0 commit comments