简体   繁体   中英

Make Python version depending on env var (using travis-ci)

Is there a way to configure travis-ci to make the Python versions dependent on a certain env var?

Please consider the following travis.yml config:

language: python
python:
  - "2.5"
  - "2.6"
  - "2.7"
env:
  - DJANGO=1.3.4
  - DJANGO=1.4.2
  - DJANGO=https://github.com/django/django/zipball/master
install:
  - pip install -q Django==$DJANGO --use-mirrors
  - pip install -e . --use-mirrors
script:
  - python src/runtests.py

Among Django 1.3 ( DJANGO=1.3.4 ) and 1.4 ( DJANGO=1.4.2 ) i also want to test against the latest development version of Django ( DJANGO=https://github.com/django/django/zipball/master ), which is basically Django 1.5.

The problem i see is that travis-ci will automatically run the integration against all specified Python versions. Django 1.5 however doesn't support Python 2.5 anymore. Is it possible to omit it for the Django development version so that i get integrations like this only:

UPDATE:

Here's a link to a live example based on Odi's answer which i've been using successfully for a few months: https://github.com/deschler/django-modeltranslation/blob/master/.travis.yml

You can specify configurations that you want to exclude from the build matrix (ie combinations that you don't want to test).

Add this to your .travis.yml :

matrix:
  exclude:
   - python: "2.5"
     env: DJANGO=https://github.com/django/django/zipball/master

Note: only exact matches will be excluded.

See the build documentation (section The Build Matrix ) for further information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM