language: python

python:
  - 2.6
  - 2.7
  - 3.2
  - 3.3
  - 3.4
  - pypy
  - pypy3

env:
  - BACKEND=c
  - BACKEND=cpp

branches:
  only:
    - master

before_install:
  - sudo apt-get update
  - sudo apt-get install gdb python$( python -c 'import sys; print("%d.%d" % sys.version_info[:2])' )-dbg || true
  - dpkg -l gdb || true

install:
  - CFLAGS="-O2 -ggdb -Wall -Wextra $(python -c 'import sys; print("-fno-strict-aliasing" if sys.version_info[0] == 2 else "")')" python setup.py build

script:
  - PYTHON_DBG="python$( python -c 'import sys; print("%d.%d" % sys.version_info[:2])' )-dbg"
  - if $PYTHON_DBG -V >&2; then CFLAGS="-O0 -ggdb" $PYTHON_DBG runtests.py -vv Debugger --backends=$BACKEND; fi
  - CFLAGS="-O2 -ggdb -Wall -Wextra $(python -c 'import sys; print("-fno-strict-aliasing" if sys.version_info[0] == 2 else "")')" python setup.py build_ext -i
  - CFLAGS="-O0 -ggdb -Wall -Wextra" python runtests.py -vv -x Debugger --backends=$BACKEND

matrix:
  allow_failures:
    - python: pypy
    - python: pypy3
  exclude:
    - python: pypy
      env: BACKEND=cpp
    - python: pypy3
      env: BACKEND=cpp      
