From 41f82b2ad4a434790791d7829ee3823d63ae1d95 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 4 Feb 2016 07:42:39 +0100 Subject: [PATCH] travis: Avoid using the default GCE mirror. We patch sources.list to use the US loudbalancer instead of the hardcoded GCE mirror which Travis uses by default - because that seems to be quite unstable. --- scripts/dev/ci_install.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/dev/ci_install.py b/scripts/dev/ci_install.py index e2be0163b..26fa19ea7 100644 --- a/scripts/dev/ci_install.py +++ b/scripts/dev/ci_install.py @@ -48,6 +48,12 @@ if TESTENV.endswith('-cov'): pip_packages.append('codecov') +def fix_sources_list(): + """The mirror used by Travis has trouble a lot, so switch to another.""" + subprocess.check_call(['sudo', 'sed', '-i', r's/us-central1\.gce/us/', + '/etc/apt/sources.list']) + + def apt_get(args): subprocess.check_call(['sudo', 'apt-get', '-y', '-q'] + args) @@ -111,12 +117,14 @@ elif TRAVIS_OS == 'linux': pkgs += ['npm', 'nodejs', 'nodejs-legacy'] if pkgs: + fix_sources_list() print("apt-get update...") apt_get(['update']) print("apt-get install...") apt_get(['install'] + pkgs) if TESTENV == 'flake8': + fix_sources_list() print("apt-get update...") apt_get(['update']) # We need an up-to-date Python because of: