Skip to content

Commit 68fc11e

Browse files
techtonikskvark
authored andcommitted
Copy (ffmpeg) .dll to fix #6 (#15)
* Copy (ffmpeg) .dll to fix #6 This attempts to copy all .dll files in build directory, where should be only ffmpeg .dll * Update appveyor.yml Use literal style block to avoid unnecessary blank lines http://stackoverflow.com/questions/3790454/in-yaml-how-do-i-break-a-string-over-multiple-lines/21699210#21699210 * Update appveyor.yml Fix source dir for ffmpeg .dlls * Update setup.py Include ffmpeg .dll into wheel * update README, licensing, fix dll copying, add video test * fix indentation * disable test for now to get artifacts * Add FFmpeg license, inject cv2 to PATH in __init__, enable video test * disable video test on other OS
1 parent 3d86359 commit 68fc11e

File tree

7 files changed

+542
-7
lines changed

7 files changed

+542
-7
lines changed

LICENSE-3RD-PARTY.txt

+508-1
Large diffs are not rendered by default.

README.rst

+6-2
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,14 @@ Licensing
7070
---------
7171

7272
Opencv-python package (scripts in this repository) is available under
73-
MIT license. The OpenCV itself is available under `3-clause BSD
73+
MIT license.
74+
75+
OpenCV itself is available under `3-clause BSD
7476
License <https://github.com/opencv/opencv/blob/master/LICENSE>`__
7577
(`LICENSE-3RD-PARTY.txt <https://github.com/skvark/opencv-python/blob/master/LICENSE-3RD-PARTY.txt>`__).
7678

79+
This software uses code of `FFmpeg <http://ffmpeg.org>`__ licensed under the `LGPLv2.1 <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>`__.
80+
7781
Versioning
7882
----------
7983

@@ -137,4 +141,4 @@ supported by the manylinux containers.
137141
OS X
138142
~~~~
139143

140-
Currently built for Python 2.7 and 3.4.
144+
Currently built for Python 2.7, 3.4 and 3.5.

appveyor.yml

+12-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ install:
2929
C:\Python35-x64\python.exe -m pip install -r requirements.txt
3030
3131
build_script:
32-
- cmd: >-
32+
- cmd: |-
3333
3434
if not exist "%APPVEYOR_BUILD_FOLDER%\opencv\build" mkdir "%APPVEYOR_BUILD_FOLDER%\opencv\build"
3535
@@ -52,36 +52,46 @@ build_script:
5252
cmake --build . --config Release
5353
5454
cd ..\..
55-
55+
cd
5656
xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build\lib\RELEASE\*.pyd" cv2
57+
xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build\bin\Release\*.dll" cv2
58+
del cv2\*64.dll
5759
5860
C:\Python27\python.exe setup.py bdist_wheel
5961
6062
del cv2\*.pyd
63+
del cv2\*.dll
6164
6265
rmdir "%APPVEYOR_BUILD_FOLDER%\build" /s /q
6366
6467
xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build64\lib\RELEASE\*.pyd" cv2
68+
xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build64\bin\Release\*64.dll" cv2
6569
6670
C:\Python27-x64\python.exe setup.py bdist_wheel
6771
6872
del cv2\*.pyd
73+
del cv2\*.dll
6974
7075
rmdir "%APPVEYOR_BUILD_FOLDER%\build" /s /q
7176
7277
xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build\lib\python3\Release\*.pyd" cv2
78+
xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build\bin\Release\*.dll" cv2
79+
del cv2\*64.dll
7380
7481
C:\Python35\python.exe setup.py bdist_wheel
7582
7683
del cv2\*.pyd
84+
del cv2\*.dll
7785
7886
rmdir "%APPVEYOR_BUILD_FOLDER%\build" /s /q
7987
8088
xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build64\lib\python3\Release\*.pyd" cv2
89+
xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build64\bin\Release\*64.dll" cv2
8190
8291
C:\Python35-x64\python.exe setup.py bdist_wheel
8392
8493
del cv2\*.pyd
94+
del cv2\*.dll
8595
8696
rmdir "%APPVEYOR_BUILD_FOLDER%\build" /s /q
8797

cv2/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
import sys
2+
import os
3+
4+
# FFMPEG dll is not found on Windows without this
5+
os.environ["PATH"] += os.pathsep + os.path.dirname(os.path.realpath(__file__))
6+
27
from . import cv2
38
sys.modules['cv2'] = cv2

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def is_pure(self):
3333
if os.name == 'posix':
3434
package_data['cv2'] = ['*.so']
3535
else:
36-
package_data['cv2'] = ['*.pyd']
36+
package_data['cv2'] = ['*.pyd', '*.dll']
3737

3838
setup(name='opencv-python',
3939
version=opencv_version,

tests/SampleVideo_1280x720_1mb.mp4

1.01 MB
Binary file not shown.

tests/test.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
import unittest
2+
import os
23

34
class OpenCVTest(unittest.TestCase):
45
""" Simple functionality tests. """
56

67
def test_import(self):
78
""" Test that the cv2 module can be imported. """
8-
import cv2
9+
import cv2
10+
11+
def test_video_capture(self):
12+
13+
if os.name != 'posix':
14+
import cv2
15+
16+
cap = cv2.VideoCapture("SampleVideo_1280x720_1mb.mp4")
17+
self.assertTrue(cap.isOpened())

0 commit comments

Comments
 (0)