1*4882a593SmuzhiyunDisable automatic downloading of components! 2*4882a593Smuzhiyun 3*4882a593SmuzhiyunUpstream-Status: Inappropriate [disable feature] 4*4882a593Smuzhiyun 5*4882a593SmuzhiyunSigned-off-by: Mark Hatle <mark.hatle@xilinx.com> 6*4882a593Smuzhiyun 7*4882a593Smuzhiyun--- a/setup.py 8*4882a593Smuzhiyun+++ b/setup.py 9*4882a593Smuzhiyun@@ -317,7 +317,6 @@ setup( # Finally, pass this all along t 10*4882a593Smuzhiyun "certifi>=2020.06.20", 11*4882a593Smuzhiyun "numpy>=1.17", 12*4882a593Smuzhiyun "setuptools_scm>=4", 13*4882a593Smuzhiyun- "setuptools_scm_git_archive", 14*4882a593Smuzhiyun ], 15*4882a593Smuzhiyun install_requires=[ 16*4882a593Smuzhiyun "cycler>=0.10", 17*4882a593Smuzhiyun--- a/setupext.py 18*4882a593Smuzhiyun+++ b/setupext.py 19*4882a593Smuzhiyun@@ -64,40 +64,7 @@ def get_from_cache_or_download(url, sha) 20*4882a593Smuzhiyun BytesIO 21*4882a593Smuzhiyun The file loaded into memory. 22*4882a593Smuzhiyun """ 23*4882a593Smuzhiyun- cache_dir = _get_xdg_cache_dir() 24*4882a593Smuzhiyun- 25*4882a593Smuzhiyun- if cache_dir is not None: # Try to read from cache. 26*4882a593Smuzhiyun- try: 27*4882a593Smuzhiyun- data = (cache_dir / sha).read_bytes() 28*4882a593Smuzhiyun- except IOError: 29*4882a593Smuzhiyun- pass 30*4882a593Smuzhiyun- else: 31*4882a593Smuzhiyun- if _get_hash(data) == sha: 32*4882a593Smuzhiyun- return BytesIO(data) 33*4882a593Smuzhiyun- 34*4882a593Smuzhiyun- # jQueryUI's website blocks direct downloads from urllib.request's 35*4882a593Smuzhiyun- # default User-Agent, but not (for example) wget; so I don't feel too 36*4882a593Smuzhiyun- # bad passing in an empty User-Agent. 37*4882a593Smuzhiyun- with urllib.request.urlopen( 38*4882a593Smuzhiyun- urllib.request.Request(url, headers={"User-Agent": ""}), 39*4882a593Smuzhiyun- context=_get_ssl_context()) as req: 40*4882a593Smuzhiyun- data = req.read() 41*4882a593Smuzhiyun- 42*4882a593Smuzhiyun- file_sha = _get_hash(data) 43*4882a593Smuzhiyun- if file_sha != sha: 44*4882a593Smuzhiyun- raise Exception( 45*4882a593Smuzhiyun- f"The downloaded file does not match the expected sha. {url} was " 46*4882a593Smuzhiyun- f"expected to have {sha} but it had {file_sha}") 47*4882a593Smuzhiyun- 48*4882a593Smuzhiyun- if cache_dir is not None: # Try to cache the downloaded file. 49*4882a593Smuzhiyun- try: 50*4882a593Smuzhiyun- cache_dir.mkdir(parents=True, exist_ok=True) 51*4882a593Smuzhiyun- with open(cache_dir / sha, "xb") as fout: 52*4882a593Smuzhiyun- fout.write(data) 53*4882a593Smuzhiyun- except IOError: 54*4882a593Smuzhiyun- pass 55*4882a593Smuzhiyun- 56*4882a593Smuzhiyun- return BytesIO(data) 57*4882a593Smuzhiyun+ raise IOError(f"Automatic downloading is disabled.") 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun def get_and_extract_tarball(urls, sha, dirname): 61