Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 656
Cel Skeggs Avatar asked May 28 '15 02:05

Cel Skeggs


People also ask

Which of the following file is used to configure the Travis CI?

Configuration. Travis CI is configured by adding a file named . travis. yml , which is a YAML format text file, to the root directory of the repository.


2 Answers

If you want to use the container based infrastructure you can make use of the apt addon:

addons:   apt:     sources:       - deadsnakes # source required so it finds the package definition below     packages:       - python3.5 

Packages that can be used are listed here

Update

In order to use dependencies with c-extensions like psycopg2 or pyYAML it is also necessary to add python3.4-dev

like image 183
mfussenegger Avatar answered Oct 11 '22 19:10

mfussenegger


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 
like image 41
Eric Appelt Avatar answered Oct 11 '22 17:10

Eric Appelt