Skip to content

TST: Enable cache directories on AppVeyor. #8179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ script:
pip install $PRE requests==2.9.2 linkchecker
linkchecker build/html/index.html
fi

before_cache:
- rm -rf $HOME/.cache/matplotlib/tex.cache
- rm -rf $HOME/.cache/matplotlib/test_cache

Expand Down
4 changes: 4 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ platform:
# all our python builds have to happen in tests_script...
build: false

cache:
- '%LOCALAPPDATA%\pip\Cache'
- '%USERPROFILE%\.cache\matplotlib'

init:
- cmd: "ECHO %PYTHON_VERSION% PYTEST=%USE_PYTEST% %CONDA_INSTALL_LOCN%"

Expand Down
22 changes: 14 additions & 8 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,12 +1146,15 @@ def do_custom_build(self):
os.path.isfile(tarball_cache_path)):
if get_file_hash(tarball_cache_path) == LOCAL_FREETYPE_HASH:
try:
# fail on Lpy, oh well
os.makedirs('build', exist_ok=True)
os.makedirs('build')
except OSError:
# Don't care if it exists.
pass
try:
shutil.copy(tarball_cache_path, tarball_path)
print('Using cached tarball: {}'
.format(tarball_cache_path))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The except just below could probably be just for OSError?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixed, BTW.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

except:
except OSError:
# If this fails, oh well just re-download
pass

Expand All @@ -1165,12 +1168,12 @@ def do_custom_build(self):
os.makedirs('build')

sourceforge_url = (
'http://downloads.sourceforge.net/project/freetype'
'https://downloads.sourceforge.net/project/freetype'
'/freetype2/{0}/'.format(LOCAL_FREETYPE_VERSION)
)
url_fmts = (
sourceforge_url + '{0}',
'http://download.savannah.gnu.org/releases/freetype/{0}'
'https://download.savannah.gnu.org/releases/freetype/{0}'
)
for url_fmt in url_fmts:
tarball_url = url_fmt.format(tarball)
Expand All @@ -1186,12 +1189,15 @@ def do_custom_build(self):
raise IOError("Failed to download freetype")
if get_file_hash(tarball_path) == LOCAL_FREETYPE_HASH:
try:
# this will fail on LPy, oh well
os.makedirs(tarball_cache_dir, exist_ok=True)
os.makedirs(tarball_cache_dir)
except OSError:
# Don't care if it exists.
pass
try:
shutil.copy(tarball_path, tarball_cache_path)
print('Cached tarball at: {}'
.format(tarball_cache_path))
except:
except OSError:
# again, we do not care if this fails, can
# always re download
pass
Expand Down