environment:

  global:
    # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
    # /E:ON and /V:ON options are not enabled in the batch script intepreter
    # See: http://stackoverflow.com/a/13751649/163740
    WITH_COMPILER: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_compiler.cmd"
    DISTRIBUTIONS: "bdist_wheel"

  matrix:
    - PYTHON: "C:\\Python27"
      PYTHON_VERSION: "2.7.11"
      PYTHON_ARCH: "32"

    - PYTHON: "C:\\Python34"
      PYTHON_VERSION: "3.4.3"
      PYTHON_ARCH: "32"

    - PYTHON: "C:\\Python35"
      PYTHON_VERSION: "3.5.0"
      PYTHON_ARCH: "32"

    - PYTHON: "C:\\Python27-x64"
      PYTHON_VERSION: "2.7.11"
      PYTHON_ARCH: "64"

    - PYTHON: "C:\\Python34-x64"
      PYTHON_VERSION: "3.4.3"
      PYTHON_ARCH: "64"

    - PYTHON: "C:\\Python35-x64"
      PYTHON_VERSION: "3.5.0"
      PYTHON_ARCH: "64"

init:
  - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"

install:
  - cinst winpcap
  - "powershell appveyor\\install.ps1"
  - "set HOME=%APPVEYOR_BUILD_FOLDER%"
  - "set WPDPACK_BASE=%APPVEYOR_BUILD_FOLDER%\\WpdPack"
  - "%PYTHON%/python -m pip install -U pip"  # Upgrade pip
  - "%WITH_COMPILER% %PYTHON%/python setup.py build"
  - "%WITH_COMPILER% %PYTHON%/python setup.py %DISTRIBUTIONS%"
  - ps: "ls dist"

  # Install the wheel to test it
  - "%PYTHON%/python -m pip install --ignore-installed --pre --no-index --find-links dist/ pcapy"

# Appveyor's build step is specific to .NET projects, so we build in the
# install step instead.
build: off

test_script:
  - "cd tests"
  - "%PYTHON%/python pcapytests.py"

  # Move back to the project folder
  - "cd .."

artifacts:
  - path: dist\*
