8000 Build working for linux and OSX by c-martinez · Pull Request #10 · opencv/opencv-python · GitHub
[go: up one dir, main page]

Skip to content

Build working for linux and OSX #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 3, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Testing...
  • Loading branch information
c-martinez committed Jul 19, 2016
commit d45d4132278f3cd8669af07fcd2c5e7def6da966
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "opencv"]
path = opencv
url = https://github.com/Itseez/opencv.git
[submodule "multibuild"]
path = multibuild
url = https://github.com/matthew-brett/multibuild.git
169 changes: 107 additions & 62 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,113 @@
notifications:
email: false
env:
global:
- REPO_DIR=your-project
# Commit from your-project that you want to build
- BUILD_COMMIT=v0.1.0
# pip dependencies to _build_ your project
- BUILD_DEPENDS="Cython numpy"
# pip dependencies to _test_ your project. Include any dependencies
# that you need, that are also specified in BUILD_DEPENDS, this will be
# a separate install.
- TEST_DEPENDS="numpy scipy pytest"
- PLAT=x86_64
- UNICODE_WIDTH=32
- WHEELHOUSE_UPLOADER_USERNAME=travis-worker
# Following generated with
# travis encrypt -r your-org/your-project-wheels WHEELHOUSE_UPLOADER_SECRET=<the api key>
# This is for Rackspace uploads. Contact Matthew Brett, or the
# scikit-learn team, for # permission (and the API key) to upload to
# the Rackspace account used here, or use your own account.
#- secure:
# "MNKyBWOzu7JAUmC0Y+JhPKfytXxY/ADRmUIMEWZV977FLZPgYctqd+lqel2QIFgdHDO1CIdTSymOOFZckM9ICUXg9Ta+8oBjSvAVWO1ahDcToRM2DLq66fKg+NKimd2OfK7x597h/QmUSl4k8XyvyyXgl5jOiLg/EJxNE2r83IA="

matrix:
include:
- sudo: required
services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64
PYTHON_VERSION=26
- sudo: required
services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64
PYTHON_VERSION=27
- sudo: required
services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64
PYTHON_VERSION=33
- sudo: required
services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64
PYTHON_VERSION=34
- sudo: required
services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64
PYTHON_VERSION=35
language: python
# The travis Python version is unrelated to the version we build and test
# with. This is set with the MB_PYTHON_VERSION variable.
python: 3.5
sudo: required
dist: trusty
services: docker

- sudo: required
services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_i686
PRE_CMD=linux32
PYTHON_VERSION=26
- sudo: required
services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_i686
PRE_CMD=linux32
PYTHON_VERSION=27
- sudo: required
services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_i686
PRE_CMD=linux32
PYTHON_VERSION=33
- sudo: required
services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_i686
PRE_CMD=linux32
PYTHON_VERSION=34
- sudo: required
services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_i686
PRE_CMD=linux32
PYTHON_VERSION=35
exclude:
# Exclude the default Python 3.5 build
- python: 3.5
include:
- os: linux
env:
- MB_PYTHON_VERSION=2.6
- os: linux
env:
- MB_PYTHON_VERSION=2.6
- PLAT=i686
- os: linux
env: MB_PYTHON_VERSION=2.7
- os: linux
env:
- MB_PYTHON_VERSION=2.7
- UNICODE_WIDTH=16
- os: linux
env:
- MB_PYTHON_VERSION=2.7
- PLAT=i686
- os: linux
env:
- MB_PYTHON_VERSION=2.7
- PLAT=i686
- UNICODE_WIDTH=16
- os: linux
env:
- MB_PYTHON_VERSION=3.3
- os: linux
env:
- MB_PYTHON_VERSION=3.3
- PLAT=i686
- os: linux
env:
- MB_PYTHON_VERSION=3.4
- os: linux
env:
- MB_PYTHON_VERSION=3.4
- PLAT=i686
- os: linux
env:
- MB_PYTHON_VERSION=3.5
- os: linux
env:
- MB_PYTHON_VERSION=3.5
- PLAT=i686
- os: osx
language: generic
env:
- MB_PYTHON_VERSION=2.7
- os: osx
language: generic
env:
- MB_PYTHON_VERSION=3.4
- os: osx
language: generic
env:
- MB_PYTHON_VERSION=3.5

before_install:
- source multibuild/common_utils.sh
- source multibuild/travis_steps.sh
- before_install

install:
- docker pull $DOCKER_IMAGE
# Maybe get and clean and patch source
- clean_code $REPO_DIR $BUILD_COMMIT
- build_wheel $REPO_DIR $PLAT

script:
- docker run --rm -v `pwd`:/io -e PYTHON_VERSION=$PYTHON_VERSION $DOCKER_IMAGE $PRE_CMD /io/travis/build-wheels.sh
- ls wheelhouse/
- install_run $PLAT

after_success:
# Upload wheels to Rackspace container
- pip install wheelhouse-uploader
# This uploads the wheels to a Rackspace container owned by the
# scikit-learn team, available at http://wheels.scipy.org. See above
# for information on using this account or choosing another.
- python -m wheelhouse_uploader upload --local-folder
${TRAVIS_BUILD_DIR}/wheelhouse/
--no-update-index
wheels
16 changes: 16 additions & 0 deletions config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Define custom utilities
# Test for OSX with [ -n "$IS_OSX" ]

function pre_build {
if [ -n "$IS_OSX" ]; then
echo "Don't know how to build for OSX yet..."
else
source travis/build-wheels.sh
fi
}

function run_tests {
# Runs tests on installed distribution from an empty directory
python --version
python -c 'import sys; import yourpackage; sys.exit(yourpackage.test())'
}
1 change: 1 addition & 0 deletions multibuild
Submodule multibuild added at 7abbd0
1 change: 1 addition & 0 deletions opencv
Submodule opencv added at b34272
12 changes: 5 additions & 7 deletions travis/build-wheels.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/bin/bash

/opt/_internal/cpython-3.5.1/bin/pip3.5 install --upgrade git+git://github.com/pypa/auditwheel

cd /io
git clone -q --branch=master https://github.com/Itseez/opencv.git opencv
export $PYTHON_VERSION=${MB_PYTHON_VERSION/./}

for PYBIN in /opt/python/cp$PYTHON_VERSION*/bin; do
$PYBIN/python find_version.py
Expand All @@ -12,7 +10,7 @@ for PYBIN in /opt/python/cp$PYTHON_VERSION*/bin; do
# Begin build
cd opencv
mkdir build
if [[ $PYTHON_VERSION == 2* ]]; then
if [[ $MB_PYTHON_VERSION == 2* ]]; then
cmake28 -H"." -B"build" -DCMAKE_BUILD_TYPE=Release -DBUILD_opencv_python3=OFF -DBUILD_opencv_java=OFF -DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF \
-DPYTHON2INTERP_FOUND=ON -DPYTHON2LIBS_FOUND=ON \
Expand All @@ -25,7 +23,7 @@ for PYBIN in /opt/python/cp$PYTHON_VERSION*/bin; do
(cd build; make -j5 opencv_python2)
fi

if [[ $PYTHON_VERSION == 3* ]]; then
if [[ $MB_PYTHON_VERSION == 3* ]]; then
cmake28 -H"." -B"build" -DCMAKE_BUILD_TYPE=Release -DBUILD_opencv_python2=OFF -DBUILD_opencv_java=OFF -DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF \
-DPYTHON3INTERP_FOUND=ON -DPYTHON3LIBS_FOUND=ON \
Expand All @@ -39,11 +37,11 @@ for PYBIN in /opt/python/cp$PYTHON_VERSION*/bin; do
fi
cd ..

if [[ $PYTHON_VERSION == 2* ]]; then
if [[ $MB_PYTHON_VERSION == 2* ]]; then
cp opencv/build/lib/cv2.so cv2/
fi

if [[ $PYTHON_VERSION == 3* ]]; then
if [[ $MB_PYTHON_VERSION == 3* ]]; then
cp opencv/build/lib/python3/*.so cv2/
fi

Expand Down
0