43
43
from distutils .dist import Distribution
44
44
45
45
import 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 )
47
48
48
49
# Get the version from versioneer
49
50
import versioneer
@@ -121,6 +122,7 @@ def _download_jquery_to(dest):
121
122
# Note: When bumping the jquery-ui version, also update the versions in
122
123
# single_figure.html and all_figures.html.
123
124
url = "https://jqueryui.com/resources/download/jquery-ui-1.12.1.zip"
125
+ sha = 'f8233674366ab36b2c34c577ec77a3d70cac75d2e387d8587f3836345c0f624d'
124
126
if not os .path .exists (os .path .join (dest , "jquery-ui-1.12.1" )):
125
127
try :
126
128
os .makedirs (dest )
@@ -130,10 +132,9 @@ def _download_jquery_to(dest):
130
132
# jQueryUI's website blocks direct downloads from urllib.request's
131
133
# default User-Agent, but not (for example) wget; so I don't feel too
132
134
# 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 )
137
138
138
139
139
140
# Relying on versioneer's implementation detail.
0 commit comments