8000 fix setup.py and try speed up the build on MacOS/Linux · NaxAlpha/opencv-python@1fa9ac0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1fa9ac0

Browse files
committed
fix setup.py and try speed up the build on MacOS/Linux
1 parent 4fe0582 commit 1fa9ac0

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

setup.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,20 @@
88
contrib_build = False
99
package_name = "opencv-python"
1010

11-
if int(os.getenv('ENABLE_CONTRIB', 0)) == 1:
12-
contrib_build = True
11+
contrib = os.getenv('ENABLE_CONTRIB', None)
12+
13+
if contrib is not None:
14+
if int(contrib) == 1:
15+
contrib_build = True
16+
else:
17+
try:
18+
print("Trying to read contrib enable flag from file...")
19+
with open("contrib.enabled") as f:
20+
flag = int(f.read(1))
21+
if flag == 1:
22+
contrib_build = True
23+
except:
24+
pass
1325

1426
if contrib_build:
1527
package_name = "opencv-contrib-python"

travis/build-wheels-osx.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fi
107107

108108

109109
echo 'Begin build'
110-
make -j4
110+
make -j2
111111

112112
# Moving back to opencv-python
113113
cd ../..

travis/build-wheels.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ for PYBIN in /opt/python/cp$PYTHON_VERSION*/bin; do
7272

7373
if [[ $PYTHON_VERSION == 2* ]]; then
7474
echo 'Build for Py2'
75-
(cd build; make -j5 opencv_python2)
75+
(cd build; make -j2 opencv_python2)
7676
fi
7777

7878
if [[ $PYTHON_VERSION == 3* ]]; then
7979
echo 'Build for Py3'
80-
(cd build; make -j5 opencv_python3)
80+
(cd build; make -j2 opencv_python3)
8181
fi
8282

8383

0 commit comments

Comments
 (0)
0