From d89cd967e66e1695e1cf0a31ade1f1333dfd958b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 2 Mar 2017 01:58:33 -0500 Subject: [PATCH 1/4] TST: Enable cache directories on AppVeyor. --- appveyor.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index df916cd9de9b..653e7d5ebd00 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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%" From 3a1a09358392fe926ec8cefc7c266ff89fe03e20 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 2 Mar 2017 22:13:20 -0500 Subject: [PATCH 2/4] Use secure links to FreeType tarballs. --- setupext.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setupext.py b/setupext.py index 3f6430cb15dd..7c2065b88280 100644 --- a/setupext.py +++ b/setupext.py @@ -1165,12 +1165,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) From 699e8d4a4edd6cf42b9d8299dc6d13d46d7976ca Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 2 Mar 2017 22:27:03 -0500 Subject: [PATCH 3/4] Try harder to cache FreeType tarball on Python 2. --- setupext.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/setupext.py b/setupext.py index 7c2065b88280..1b2506da2c6b 100644 --- a/setupext.py +++ b/setupext.py @@ -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)) - except: + except OSError: # If this fails, oh well just re-download pass @@ -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 From 625373215e5dc625d78d25ede3191409fc1742d3 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 3 Mar 2017 00:01:05 -0500 Subject: [PATCH 4/4] TST: Always delete extra cache files on Travis. Note, we don't need to do this on AppVeyor because the cache directories are different. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 77fc2f8963c3..625d2f4c077d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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