提交 b8765378 编写于 作者: O Olli-Pekka Heinisuo

modify versioning and tests

上级 18a247cb
version: '{build}'
install: install:
- cmd: >- - cmd: >-
git clone -q --branch=master https://github.com/Itseez/opencv.git "%APPVEYOR_BUILD_FOLDER%\opencv git clone -q --branch=master https://github.com/Itseez/opencv.git "%APPVEYOR_BUILD_FOLDER%\opencv
C:\Python35\python.exe find_version.py > tmp
set /p opencv_version= < tmp
del tmp
echo %opencv_version%
C:\Python27\python.exe -m pip install --upgrade pip C:\Python27\python.exe -m pip install --upgrade pip
...@@ -21,6 +27,8 @@ install: ...@@ -21,6 +27,8 @@ install:
C:\Python35-x64\python.exe -m pip install -r requirements.txt C:\Python35-x64\python.exe -m pip install -r requirements.txt
version: '%opencv_version%-{build}'
build_script: build_script:
- cmd: >- - cmd: >-
...@@ -48,25 +56,25 @@ build_script: ...@@ -48,25 +56,25 @@ build_script:
xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build\lib\RELEASE\*.pyd" cv2 xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build\lib\RELEASE\*.pyd" cv2
C:\Python27\python.exe setup.py bdist_wheel C:\Python27\python.exe setup.py bdist_wheel --opencv-version=%opencv_version%
del cv2\*.pyd del cv2\*.pyd
xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build64\lib\RELEASE\*.pyd" cv2 xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build64\lib\RELEASE\*.pyd" cv2
C:\Python27-x64\python.exe setup.py bdist_wheel C:\Python27-x64\python.exe setup.py bdist_wheel --opencv-version=%opencv_version%
del cv2\*.pyd del cv2\*.pyd
xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build\lib\python3\Release\*.pyd" cv2 xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build\lib\python3\Release\*.pyd" cv2
C:\Python35\python.exe setup.py bdist_wheel C:\Python35\python.exe setup.py bdist_wheel --opencv-version=%opencv_version%
del cv2\*.pyd del cv2\*.pyd
xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build64\lib\python3\Release\*.pyd" cv2 xcopy "%APPVEYOR_BUILD_FOLDER%\opencv\build64\lib\python3\Release\*.pyd" cv2
C:\Python35-x64\python.exe setup.py bdist_wheel C:\Python35-x64\python.exe setup.py bdist_wheel --opencv-version=%opencv_version%
del cv2\*.pyd del cv2\*.pyd
...@@ -86,13 +94,13 @@ before_test: ...@@ -86,13 +94,13 @@ before_test:
test_script: test_script:
- cmd: >- - cmd: >-
C:\Python27\python.exe -c "import cv2" C:\Python27\python.exe -m unittest tests/test
C:\Python27-x64\python.exe -c "import cv2" C:\Python27-x64\python.exe -m unittest tests/test
C:\Python35\python.exe -c "import cv2" C:\Python35\python.exe -m unittest tests/test
C:\Python35-x64\python.exe -c "import cv2" C:\Python35-x64\python.exe -m unittest tests/test
artifacts: artifacts:
- path: dist\*.whl - path: dist\*.whl
......
import sys
opencv_version = ""
# dig out the version from OpenCV sources
version_file_path = "opencv/modules/core/include/opencv2/core/version.hpp"
with open(version_file_path, 'r') as f:
for line in f:
words = line.split()
if "CV_VERSION_MAJOR" in words:
opencv_version += words[2]
opencv_version += "."
if "CV_VERSION_MINOR" in words:
opencv_version += words[2]
opencv_version += "."
if "CV_VERSION_REVISION" in words:
opencv_version += words[2]
break
sys.stdout.write(opencv_version)
\ No newline at end of file
...@@ -4,6 +4,16 @@ import pip ...@@ -4,6 +4,16 @@ import pip
import os import os
import sys import sys
opencv_version = ""
if "--opencv-version" in sys.argv:
index = sys.argv.index('--opencv-version')
sys.argv.pop(index)
opencv_version = sys.argv.pop(index)
else:
print("Error: no version info (--opencv-version missing), exiting.")
exit(1)
numpy_version = "" numpy_version = ""
# Get required numpy version # Get required numpy version
...@@ -11,27 +21,6 @@ for package in pip.get_installed_distributions(): ...@@ -11,27 +21,6 @@ for package in pip.get_installed_distributions():
if package.key == "numpy": if package.key == "numpy":
numpy_version = package.version numpy_version = package.version
opencv_version = ""
# dig the version from OpenCV sources
version_file_path = "opencv/modules/core/include/opencv2/core/version.hpp"
with open(version_file_path, 'r') as f:
for line in f:
words = line.split()
if "CV_VERSION_MAJOR" in words:
opencv_version += words[2]
opencv_version += "."
if "CV_VERSION_MINOR" in words:
opencv_version += words[2]
opencv_version += "."
if "CV_VERSION_REVISION" in words:
opencv_version += words[2]
break
class BinaryDistribution(Distribution): class BinaryDistribution(Distribution):
""" Forces BinaryDistribution. """ """ Forces BinaryDistribution. """
def has_ext_modules(asd): def has_ext_modules(asd):
......
import unittest
class OpenCVTest(unittest.TestCase):
""" Simple functionality tests. """
def test_import(self):
""" Test that the cv2 module can be imported. """
import cv2
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册