Skip to content

Commit 2945f7f

Browse files
committed
update dockerfiles, fix setup.py
1 parent c5bb48b commit 2945f7f

File tree

4 files changed

+16
-44
lines changed

4 files changed

+16
-44
lines changed

docker/README.md

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
### Customized manylinux images for opencv-python
22

3-
This folder includes Dockerfiles for extending both ``i686`` and ``x86_64`` manylinux images.
3+
The subfolders include Dockerfiles for extending both ``i686`` and ``x86_64`` manylinux1 and manylinux2014 images.
44

5-
The extended images were created to be able to build OpenCV in reasonable time with Travis. The images are hosted at https://quay.io/user/skvark.
5+
Manylinux2014 is used in wheels with version 3.4.10.* / 4.3.0.* and above.
66

7-
The images have following extra software installed:
7+
The extended images were created to be able to build OpenCV in reasonable time with Travis. The images are hosted at https://quay.io/user/skvark.
88

9-
- Qt 4.8.7
10-
- Cmake 3.9.0
11-
- FFmpeg with libvpx (latest snapshots at the build time) and recent openssl + other FFmpeg dependencies built from sources
12-
- Some missing headers included from more recent Linux to be able to enable V4L / V4L2 support in OpenCV
9+
See the dockerfiles for more info.

docker/manylinux2014/Dockerfile_i686

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM quay.io/pypa/manylinux2014_i686:latest
22

3-
RUN yum install freetype-devel bzip2-devel curl-devel qt5-qtbase-devel lapack-devel -y
3+
RUN yum install freetype-devel bzip2-devel curl-devel qt5-qtbase-devel blas-devel lapack-devel atlas-devel -y
44

55
RUN mkdir ~/ffmpeg_sources && \
66
cd ~/ffmpeg_sources && \

docker/manylinux2014/Dockerfile_x86_64

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM quay.io/pypa/manylinux2014_x86_64:latest
22

3-
RUN yum install freetype-devel bzip2-devel curl-devel qt5-qtbase-devel lapack-devel -y
3+
RUN yum install freetype-devel bzip2-devel curl-devel qt5-qtbase-devel blas-devel lapack-devel atlas-devel -y
44

55
RUN mkdir ~/ffmpeg_sources && \
66
cd ~/ffmpeg_sources && \

setup.py

+10-35
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ def main():
3434
numpy_version = get_or_install("numpy", minimum_supported_numpy)
3535
get_or_install("scikit-build")
3636
get_or_install("cmake")
37+
3738
import skbuild
39+
from skbuild import cmaker
40+
41+
python_version = cmaker.CMaker.get_python_version()
42+
python_lib_path = cmaker.CMaker.get_python_library(python_version)
43+
python_include_dir = cmaker.CMaker.get_python_include_dir(python_version)
3844

3945
if os.path.exists(".git"):
4046

@@ -109,7 +115,8 @@ def main():
109115
+ [
110116
# skbuild inserts PYTHON_* vars. That doesn't satisfy opencv build scripts in case of Py3
111117
"-DPYTHON_DEFAULT_EXECUTABLE=%s" % sys.executable,
112-
"-DPYTHON3_INCLUDE_DIR=%s" % sysconfig.get_paths()["include"],
118+
"-DPYTHON3_INCLUDE_DIR=%s" % python_include_dir,
119+
"-DPYTHON3_LIBRARY=%s" % python_lib_path,
113120
"-DBUILD_opencv_python3=ON",
114121
"-DBUILD_opencv_python2=OFF",
115122
# When off, adds __init__.py and a few more helper .py's. We use our own helper files with a different structure.
@@ -127,27 +134,6 @@ def main():
127134
"-DBUILD_PERF_TESTS=OFF",
128135
"-DBUILD_DOCS=OFF",
129136
]
130-
+ (
131-
[
132-
"-DPYTHON3_LIBRARY=%s"
133-
% os.path.join(
134-
*[
135-
sysconfig.get_config_var("BINDIR"),
136-
"libs",
137-
"python{}.lib".format(
138-
"".join(str(v) for v in sys.version_info[:2])
139-
),
140-
]
141-
)
142-
]
143-
if sys.platform.startswith("win")
144-
else [
145-
"-DPYTHON3_LIBRARY=%s"
146-
% os.path.join(
147-
"/usr/lib/x86_64-linux-gnu/", sysconfig.get_config_var("LDLIBRARY")
148-
)
149-
]
150-
)
151137
+ (
152138
["-DOPENCV_EXTRA_MODULES_PATH=" + os.path.abspath("opencv_contrib/modules")]
153139
if build_contrib
@@ -178,9 +164,10 @@ def main():
178164

179165
if sys.platform.startswith("linux"):
180166
cmake_args.append("-DWITH_V4L=ON")
167+
cmake_args.append("-DWITH_LAPACK=ON")
181168
cmake_args.append("-DENABLE_PRECOMPILED_HEADERS=OFF")
182169

183-
if sys.platform.startswith('linux') and not x64:
170+
if sys.platform.startswith("linux") and not x64:
184171
subprocess.check_call("patch -p0 < patches/patchOpenEXR", shell=True)
185172

186173
# Fixes for macOS builds
@@ -190,21 +177,9 @@ def main():
190177

191178
if "CMAKE_ARGS" in os.environ:
192179
import shlex
193-
194180
cmake_args.extend(shlex.split(os.environ["CMAKE_ARGS"]))
195181
del shlex
196182

197-
# ABI config variables are introduced in PEP 425
198-
if sys.version_info[:2] < (3, 2):
199-
import warnings
200-
201-
warnings.filterwarnings(
202-
"ignore",
203-
r"Config variable '[^']+' is unset, " r"Python ABI tag may be incorrect",
204-
category=RuntimeWarning,
205-
)
206-
del warnings
207-
208183
# works via side effect
209184
RearrangeCMakeOutput(
210185
rearrange_cmake_output_data, files_outside_package_dir, package_data.keys()

0 commit comments

Comments
 (0)