diff --git a/setup.cfg b/setup.cfg index 66aa44b..89f3898 100644 --- a/setup.cfg +++ b/setup.cfg @@ -40,9 +40,8 @@ zip_safe = False setup_requires=setuptools>=42; wheel; setuptools_scm[toml]>=3.4 install_requires= argopt - miutil[nii]>=0.1.0,!=0.4.0,!=0.4.1 + miutil[nii,web]>=0.7.2 setuptools # pkg_resources - brainweb>=1.6.2 numpy scipy include_package_data=True @@ -53,7 +52,6 @@ dev= pre-commit twine wheel - miutil[web]>=0.7.0 pytest pytest-cov pytest-timeout diff --git a/spm12/utils.py b/spm12/utils.py index da1036d..da67894 100644 --- a/spm12/utils.py +++ b/spm12/utils.py @@ -3,7 +3,9 @@ from os import path from textwrap import dedent +from miutil.fdio import extractall from miutil.mlab import get_engine +from miutil.web import urlopen_cached from pkg_resources import resource_filename try: @@ -37,21 +39,13 @@ def ensure_spm(name=None, cache="~/.spm12", version=12): if not eng.exist("spm_jobman"): log.warning("MATLAB could not find SPM.") try: - from zipfile import ZipFile - - from brainweb import get_file - log.info("Downloading to %s", cache) - fname = get_file( - "spm12.zip", + with urlopen_cached( "https://www.fil.ion.ucl.ac.uk/" "spm/download/restricted/eldorado/spm12.zip", cache, - chunk_size=2 ** 17, - ) - log.info("Extracting") - with ZipFile(fname) as fd: - fd.extractall(path=cache) + ) as fd: + extractall(fd, cache) eng.addpath(addpath) if not eng.exist("spm_jobman"): raise RuntimeError("MATLAB could not find SPM.")