diff options
author | Matthew Somerville <matthew@mysociety.org> | 2016-03-18 11:45:19 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-03-23 09:27:10 +0000 |
commit | b33eb7d3bd02ece9ff70a215290a233f6e480378 (patch) | |
tree | 77eb62f6238351301b3117ad8caae3cdeba97b93 /.travis | |
parent | 5fa83565612ca0631e8c57862d39dba26b927cb1 (diff) |
[Travis] Test multiple perl versions.
Diffstat (limited to '.travis')
-rwxr-xr-x | .travis/after_script | 8 | ||||
-rwxr-xr-x | .travis/install | 7 | ||||
-rwxr-xr-x | .travis/utils.py | 22 |
3 files changed, 26 insertions, 11 deletions
diff --git a/.travis/after_script b/.travis/after_script index 006ff7849..2a8b2268d 100755 --- a/.travis/after_script +++ b/.travis/after_script @@ -1,16 +1,12 @@ #!/usr/bin/env python -import hashlib import os import site -import subprocess import sys import tarfile +from utils import get_bundle_filename -root = os.path.join(os.path.dirname(__file__), '..') -with open(os.path.join(root, 'cpanfile.snapshot')) as cpanfile: - hash = hashlib.md5(cpanfile.read()).hexdigest() -wanted_filename = 'fixmystreet-local-%s.tgz' % hash +wanted_filename = get_bundle_filename() if os.path.exists(wanted_filename) and os.path.getsize(wanted_filename): print "File was downloaded, no need to upload" diff --git a/.travis/install b/.travis/install index 00ef16bc8..c9d0aef78 100755 --- a/.travis/install +++ b/.travis/install @@ -1,15 +1,12 @@ #!/usr/bin/env python -import hashlib import os import sys import tarfile import urllib +from utils import get_bundle_filename -root = os.path.join(os.path.dirname(__file__), '..') -with open(os.path.join(root, 'cpanfile.snapshot')) as cpanfile: - hash = hashlib.md5(cpanfile.read()).hexdigest() -wanted_filename = 'fixmystreet-local-%s.tgz' % hash +wanted_filename = get_bundle_filename() url = 'https://fixmystreet-bundle-cache.s3.amazonaws.com/%s' % wanted_filename try: diff --git a/.travis/utils.py b/.travis/utils.py new file mode 100755 index 000000000..f56b7d9d4 --- /dev/null +++ b/.travis/utils.py @@ -0,0 +1,22 @@ +import hashlib +import os + + +def get_bundle_filename(): + root = os.path.join(os.path.dirname(__file__), '..') + with open(os.path.join(root, 'cpanfile.snapshot')) as cpanfile: + hash = hashlib.md5(cpanfile.read()).hexdigest() + + try: + version = os.environ['TRAVIS_PERL_VERSION'] + except KeyError: + # Not running on Travis, assume default Travis version + version = '5.14' + + if version == '5.14': + version = '' + else: + version = '-%s' % version + + filename = 'fixmystreet-local-%s%s.tgz' % (hash, version) + return filename |