diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-02-05 16:59:28 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-02-05 18:12:48 +0000 |
commit | 1cf8f514a231924cd992a5ca4f6af692c365da4a (patch) | |
tree | 6b098c67f8996427d10d8b892bf04fcd0c8f7684 | |
parent | 46541a64e9ca47d235f4fd832024bfcfa61db673 (diff) |
[Travis] Only install boto when necessary.
And make sure file is removed if not a tar file.
-rw-r--r-- | .travis.yml | 2 | ||||
-rwxr-xr-x | .travis/after_script | 10 | ||||
-rwxr-xr-x | .travis/install | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml index 07e8bfa95..d332f4d97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ env: before_install: - sudo apt-get update -qq - - sudo apt-get install -qq jhead libgmp-dev python-boto + - sudo apt-get install -qq jhead libgmp-dev # A couple of other modules that normally come from packages, but no system stuff here - cpanm -q Math::BigInt::GMP - sudo locale-gen cy_GB.UTF-8 en_GB.UTF-8 nb_NO.UTF-8 de_CH.UTF-8 sv_SE.UTF-8 diff --git a/.travis/after_script b/.travis/after_script index 37fd37eb8..006ff7849 100755 --- a/.travis/after_script +++ b/.travis/after_script @@ -2,13 +2,11 @@ import hashlib import os +import site import subprocess import sys import tarfile -import boto -from boto.s3.key import Key - root = os.path.join(os.path.dirname(__file__), '..') with open(os.path.join(root, 'cpanfile.snapshot')) as cpanfile: hash = hashlib.md5(cpanfile.read()).hexdigest() @@ -18,6 +16,12 @@ if os.path.exists(wanted_filename) and os.path.getsize(wanted_filename): print "File was downloaded, no need to upload" sys.exit() +site.addsitedir(site.getusersitepackages()) +os.system('pip install --user boto') + +import boto +from boto.s3.key import Key + print "Creating archive..." tfile = tarfile.open(wanted_filename, 'w:gz') tfile.add('local') diff --git a/.travis/install b/.travis/install index c766d3598..b73eef330 100755 --- a/.travis/install +++ b/.travis/install @@ -19,6 +19,8 @@ try: tfile.extractall() print "Cached copy found and extracted" sys.exit(0) + else: + os.remove(wanted_filename) except IOError: os.remove(wanted_filename) |