Search code examples
pythonpython-3.xtravis-ci

How to use python 3 as a build script in non-python travis configuration?


I'm trying to use Travis CI on a C library that uses custom python3-based build scripts.

When the repository gets built, it fails on ./configure because configure uses Python 3, which isn't installed by default.

If I were building a Python project, I would use this in my .travis.yml:

python:
  - "3.4"

However, this doesn't seem to affect my repository because it is in C. (I tried running which python3 and python --version, which reported that python 3 didn't exist and python 2.7 was in use instead.)

The build script that I tried:

language: c

python:
  - "3.4"

How can I have Python 3 available in Travis CI when my project is not a Python project?


Solution

  • You should be able to just install the needed python3 packages by adding a before_install: section of your .travis.yml:

    before_install:
    - sudo apt-get update
    - sudo apt-get install python3