Skip to content

Commit 86e87d7

Browse files
native-apiskvark
authored andcommittedFeb 19, 2018
Build via setup.py proper using scikit-build (#58)
* Adjust build environment as per https://docs.opencv.org/3.1.0/d5/de5/tutorial_py_setup_in_windows.html and https://wiki.python.org/moin/WindowsCompilers#Which_Microsoft_Visual_C.2B-.2B-_compiler_to_use_with_a_specific_Python_version_.3F * The best practice is to only use requirements.txt for deployments, not for packaging * ignore PyCharm metadata * refactor to be more modular * the warnings are irrelevant in older versions * v110 toolset might introduce dependency on older runtime not likely to be present in newer systems, potentially breaking upgrade * build locally with scikit-build * adjust appveyor config to local build * cleanup * DLL load works without * fail appveyor build immediately when one job fails * * cmd doesn't expand globs * - diplication * - WinXP-related bits * pip erroneously considers cv2/ as installed package when in sourceroot * require CMake output entries to be found * 3.5+ uses different .pyd naming scheme * .pyd is placed differently in Linux * DLL is only in Windows * ignore temporary config files * Yet another .pyd naming convention in Py35 Linux. Screw checking. * Update setup.py file to flag compatibility with Python 2.7-3.4-3.5-3.6 (#57) # Conflicts: # setup.py * Adjust build environment as per https://docs.opencv.org/3.1.0/d5/de5/tutorial_py_setup_in_windows.html and https://wiki.python.org/moin/WindowsCompilers#Which_Microsoft_Visual_C.2B-.2B-_compiler_to_use_with_a_specific_Python_version_.3F * The best practice is to only use requirements.txt for deployments, not for packaging * ignore PyCharm metadata * refactor to be more modular * the warnings are irrelevant in older versions * v110 toolset might introduce dependency on older runtime not likely to be present in newer systems, potentially breaking upgrade * build locally with scikit-build * adjust appveyor config to local build * cleanup * DLL load works without * fail appveyor build immediately when one job fails * * cmd doesn't expand globs * - diplication * - WinXP-related bits * pip erroneously considers cv2/ as installed package when in sourceroot * require CMake output entries to be found * 3.5+ uses different .pyd naming scheme * .pyd is placed differently in Linux * DLL is only in Windows * ignore temporary config files * fail fast on error * * custom build logic should be unneeded now, will uncomment as needed * use the latest upstream multibuild * enable tracing - more suspicious things * save some build time * these somehow cause "Server does not allow request for unadvertised object" for GitHub * Revert "use the latest upstream multibuild" This reverts commit 915ba42. * Yet another .pyd naming convention in Py35 Linux. Screw checking. * Update setup.py file to flag compatibility with Python 2.7-3.4-3.5-3.6 (#57) # Conflicts: # setup.py * add diagnostics * * Use upstream multubuild due to the forked one abusing prebuild as build * save some time * looks like clean_code() isn't required * * Don't make CMake try Ninja first * MacOS LAPACK on Travis is still broken * See build progress as it goes * update submodules on demand * fetch source in time for find_version.py * use custom docker image * use custom multibuild * bump submodule * Linux/OSX are supposed to build with Qt support * * make shallow copies to save on download time * manylinux git is an old version * * clean up redundant syntax * reformat codeas YML multiline with dedent * IPP IW broken in Linux * + ffmpeg patch * additional deps required due to multibuild bug * +cv2.data * Use upstream multibuild with monkey patch * don't do anything if upload not needed * filter out irrelevant debug output * * clean up unused scripts * inline the remaining standalone scripts * https://github.com/matthew-brett/multibuild/issues/106 fixed * * bump OpenCV version to 3.4.0 * * opencv/opencv#10011 is available in 3.4.0 * allow for if the sourcetree is a submodule * * don't reinstall whatever happens to be preinstalled * re-add workaround for travis-ci/travis-ci#9055 * * rearrange custom CMake flags * -DWITH_GTK=OFF proved to be unneeded, gthread is among manylinux requirements * fix linux detection to work in 3.3+, too * fix data path for other OSes * don't do anything unless deployment is requested * use upstream ``devel`` multibuild * restore from backup after rebase * catch fetch error * use `devel` multibuild * comment not using --depth * remove redundant command after merge
1 parent 4b07137 commit 86e87d7

17 files changed

+479
-632
lines changed
 

‎.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,10 @@ target/
6060

6161
#Ipython Notebook
6262
.ipynb_checkpoints
63+
64+
#PyCharm
65+
/.idea
66+
67+
# Build temporary files
68+
/contrib.enabled
69+
/cv_version.py

‎.gitmodules

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
url = https://github.com/Itseez/opencv.git
44
[submodule "multibuild"]
55
path = multibuild
6-
url = https://github.com/skvark/multibuild.git
6+
url = https://github.com/matthew-brett/multibuild.git
7+
branch = devel
78
[submodule "opencv_contrib"]
89
path = opencv_contrib
910
url = https://github.com/opencv/opencv_contrib.git

‎.travis.yml

+67-50
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,72 @@
11
env:
22
global:
3-
- REPO_DIR=opencv
4-
# Commit from opencv that you want to build
5-
- BUILD_COMMIT=6d4f66472e14b29b8e1623859cfebfdc67f677c3
6-
# pip dependencies to _build_ your project
7-
- BUILD_DEPENDS="numpy==1.11.1"
8-
# pip dependencies to _test_ your project. Include any dependencies
9-
# that you need, that are also specified in BUILD_DEPENDS, this will be
10-
# a separate install.
3+
- "PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'"
4+
# pip dependencies to _test_ your project
115
- TEST_DEPENDS="numpy==1.11.1"
6+
127
- PLAT=x86_64
138
- UNICODE_WIDTH=32
149
- secure: "mU040XIYWtDjRms27deQy5fNg9HBFF9fiLfSteBaMjopZKXFUBsdMTKYGEVvX8DA879guMdjG8Prw1aCFhTTYlWgJ0Afm4YucRC0vAD4HLNhqLJ2lIpRceR3+2qPX+Oz5ATVVRi3ghBeJ20LLtNgOgf6esQVjdrYNC+YqmguClHKEYAxS7ngW42iQP8HX2anRcz9q9H7exZ9fX/D1PJfMNka/mNaB5KXZu5zdLuk/E0VbWU2tMWVIDUvx4uBlpE1d8HixEV5LHnuVE/QI36BcyucYxstTNKW6pGYgrhkYf+0PX4BphZXwY7EUBwzXsYLmyge6yH8W6NfvTW0ZasFF6xzQc9bsj+gAZN7H+hN2a42VQqIpkoJw9sU0hqzCOQf6ZvWUQgwFdAHJRHqe/zk4456WxnF0kAgbZdKaGOl0/n0WvgHNqD5bgO8Zzb1XyJTKoR+eAtYKXuz3KgpxKvZMMQVr8wMlI1cFEuGjIm+7ZrYB5jPvQrVzV/DgOq4gkPHOjjhu478UFlhGA9/XWwcyidC3b7zuBN2E7xVuTMlKdk7URB3AHXfG5bZgUG80vllQDGXQDpHVnv4Qi8bGCzI4iKTpp4fCibbqxFLxW1jhjmgePseGcie7Avpe+zXznkbmM2BqMCu3QRmtmFL3eCifwMf3rCNlAs0Sd3iLmEvyos="
1510
- secure: "omn6B+H6s0g1p9rhLGhFtFN1bSB80HCsNUUD9ROEpUirk7Sj7Wxms4CDi1f7aACANsZPXD7YZ72oNpWDJ6hSfTBf2yN1/d1iPILs7F5jt0yeratkDEOXkys1QpfMNO7r3DZ17X3IwvUGy9Mm+Sv15k+DaBdQ/65qwQ4ORIbHZRv3/lwkQ7Z88utjx6DLa9Jwc8fnEjjzIry51lO3OGJoWrjOZlOi2HV9MZ69PuuBdEEuicwfeLnV64QWRle++B51TQZC/3HF5+BBvYXm0LdvV4nSQVa9nTXaOWYcBROPNZizktJI91G6vG6gghWmI1cDR53n9LgCbA3YkPTJm/5Gjn9D+gfU5F16WQ4PFOHfzPZD8nTVmlUDUiuQ30W9QZ+O2ct7wi/xF4/Ff7V+0RIqGSnjhX6SGWk7UziQyGgCjBvYiRIQzfUyGu+86vrqNVXCyBlKOz6rWStTyq/Z0KEIXZFqop+ddeYdsEem5ZxCQ51uTpRMynVgEdKj++1Hn5411Rhntw0Am7RWdDEbFJ65OUyIpNtvlcHVM7ur03oz0hGcZIIkxWHJrCdr80Nw9r/s6KXYvidCNsu4SPx0XYo8KiTA6E2lkIAa5Ct6dZR6m5gjG2vmvlKzRmoD/7byJZN66usNxBh2LuKlgNFuHfG6iR+I6f3XCNmSUOJfm7KZYVI="
1611

17-
language: python
18-
# The travis Python version is unrelated to the version we build and test
19-
# with. This is set with the MB_PYTHON_VERSION variable.
20-
python: 3.5
12+
13+
# Host Python is never used
14+
language: generic
15+
# Required to invoke docker ourselves as per https://docs.travis-ci.com/user/docker/
2116
sudo: required
22-
dist: trusty
2317
services: docker
18+
# https://docs.travis-ci.com/user/reference/trusty/
19+
dist: trusty
20+
21+
# Save some time, we and setup check them out on demand instead
22+
# https://docs.travis-ci.com/user/customizing-the-build/#Git-Clone-Depth
23+
git:
24+
submodules: false
25+
2426

2527
matrix:
26-
exclude:
27-
# Exclude the default Python 3.5 build
28-
- python: 3.5
28+
fast_finish: true
2929
include:
3030

3131
# default builds for MacOS
3232
- os: osx
33-
language: generic
3433
osx_image: xcode8.3
3534
env:
3635
- MB_PYTHON_VERSION=2.7
3736
- ENABLE_CONTRIB=0
3837
- os: osx
39-
language: generic
4038
osx_image: xcode8.3
4139
env:
4240
- MB_PYTHON_VERSION=3.4
4341
- ENABLE_CONTRIB=0
4442
- os: osx
45-
language: generic
4643
osx_image: xcode8.3
4744
env:
4845
- MB_PYTHON_VERSION=3.5
4946
- ENABLE_CONTRIB=0
5047
- os: osx
51-
language: generic
5248
osx_image: xcode8.3
5349
env:
5450
- MB_PYTHON_VERSION=3.6
5551
- ENABLE_CONTRIB=0
5652

5753
# Contrib builds for MacOS
5854
- os: osx
59-
language: generic
6055
osx_image: xcode8.3
6156
env:
6257
- MB_PYTHON_VERSION=2.7
6358
- ENABLE_CONTRIB=1
6459
- os: osx
65-
language: generic
6660
osx_image: xcode8.3
6761
env:
6862
- MB_PYTHON_VERSION=3.4
6963
- ENABLE_CONTRIB=1
7064
- os: osx
71-
language: generic
7265
osx_image: xcode8.3
7366
env:
7467
- MB_PYTHON_VERSION=3.5
7568
- ENABLE_CONTRIB=1
7669
- os: osx
77-
language: generic
7870
osx_image: xcode8.3
7971
env:
8072
- MB_PYTHON_VERSION=3.6
@@ -123,14 +115,14 @@ matrix:
123115
env:
124116
- MB_PYTHON_VERSION=3.6
125117
- ENABLE_CONTRIB=0
126-
- BUILD_DEPENDS=numpy==1.11.3
118+
127119
- TEST_DEPENDS=numpy==1.11.3
128120
- os: linux
129121
env:
130122
- MB_PYTHON_VERSION=3.6
131123
- PLAT=i686
132124
- ENABLE_CONTRIB=0
133-
- BUILD_DEPENDS=numpy==1.11.3
125+
134126
- TEST_DEPENDS=numpy==1.11.3
135127

136128
# contrib builds for Linux
@@ -184,7 +176,7 @@ matrix:
184176
env:
185177
- MB_PYTHON_VERSION=3.6
186178

187-
- BUILD_DEPENDS=numpy==1.11.3
179+
188180
- TEST_DEPENDS=numpy==1.11.3
189181
- ENABLE_CONTRIB=1
190182

@@ -193,29 +185,54 @@ matrix:
193185
- MB_PYTHON_VERSION=3.6
194186

195187
- PLAT=i686
196-
- BUILD_DEPENDS=numpy==1.11.3
188+
197189
- TEST_DEPENDS=numpy==1.11.3
198190
- ENABLE_CONTRIB=1
199191

200-
before_install:
201-
- echo $ENABLE_CONTRIB > contrib.enabled
202-
- source multibuild/common_utils.sh
203-
- source multibuild/travis_steps.sh
204-
- python find_version.py
205-
- cp LICENSE*.txt cv2/
206-
- cp opencv/data/haarcascades/*.xml cv2/data/
207-
- before_install
208-
209-
install:
210-
# Maybe get and clean and patch source
211-
- clean_code $REPO_DIR $BUILD_COMMIT
212-
- travis_wait 120 build_wheel $REPO_DIR $PLAT
213-
214-
script:
215-
- install_run $PLAT
216-
217-
after_success:
218-
# Upload wheels to pypi
219-
- pip install twine
220-
- if [ -n "$TRAVIS_TAG" ]; then twine upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv*; else echo "Tag not set, deployment skipped."; fi
221-
- source travis/deploy.sh
192+
# The first line is printed in the folding header in Travis output
193+
before_install: |
194+
# Check out and prepare the source
195+
set -e
196+
#Multibuild doesn't have releases, so --depth would break eventually (see
197+
#https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised)
198+
git submodule update --init multibuild
199+
source multibuild/common_utils.sh
200+
# https://github.com/matthew-brett/multibuild/issues/116
201+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi
202+
source multibuild/travis_steps.sh
203+
# This sets -x
204+
source multibuild_customize.sh
205+
echo $ENABLE_CONTRIB > contrib.enabled
206+
before_install
207+
# Not interested in travis internal scripts' output
208+
set +x
209+
210+
install: |
211+
# Build and package
212+
set -x
213+
build_wheel $REPO_DIR $PLAT
214+
set +x
215+
216+
script: |
217+
# Install and run tests
218+
set -x
219+
install_run $PLAT
220+
set +x
221+
222+
after_success: |
223+
# Upload wheels to pypi if requested
224+
if [ -n "$TRAVIS_TAG" ]; then
225+
set -x
226+
pip install twine
227+
228+
if [[ $ENABLE_CONTRIB == 0 ]]; then
229+
echo "This is default build. Deployment will be done to to PyPI entry opencv-python."
230+
else
231+
echo "This is contrib build. Deployment will be done to to PyPI entry opencv-contrib-python."
232+
fi
233+
234+
twine upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv*
235+
set +x
236+
else
237+
echo "Tag not set, deployment skipped."
238+
fi

0 commit comments

Comments
 (0)
Please sign in to comment.