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

change versioning schema

上级 14a8d392
| Platform| Status |
| Platform | Status |
| :---: | :---: |
| Windows | [![buildstatus](https://ci.appveyor.com/api/projects/status/5kjqpmvll5dwj5jd?svg=true)](https://ci.appveyor.com/project/skvark/opencv-python) |
| Manylinux| [![Build Status](https://travis-ci.org/skvark/opencv-python.svg?branch=master)](https://travis-ci.org/skvark/opencv-python) |
# OpenCV on wheels
Unofficial OpenCV packages for Python.
Work in progress!
The aim of this repository is to provide means to package each new [OpenCV release](https://github.com/Itseez/opencv/releases) for the most used Python versions and platforms.
......@@ -26,7 +28,8 @@ At the same time it allows anyone to build a custom version of OpenCV for any Py
The project is structured like a normal Python package with a standard ``setup.py`` file. The build process is as follows (see ``appveyor.yml``):
1. Checkout OpenCV (TO DO: pull only latest tag)
1. Checkout repository and submodules
- OpenCV is included as submodule and the version is updated manually when a new has been made
2. Find OpenCV version from the sources
2. Upgrade pip and install numpy for each Python version
3. Build OpenCV
......@@ -36,7 +39,7 @@ The project is structured like a normal Python package with a standard ``setup.p
6. Test that the Python versions can import them
7. TO DO: upload the wheels to PyPi
Currently the ``setup.py`` file parses OpenCV version information from the OpenCV sources. OpenCV depends on numpy, so ``setup.py`` checks the numpy version also with the help of pip.
Currently the ``find_version.py`` file parses OpenCV version information from the OpenCV sources. OpenCV depends on numpy, so ``setup.py`` checks the numpy version also with the help of pip.
As described earlier, for example the ``.pyd`` file on Windows is normally copied to site-packages. I don't want to pollute the root folder, so the ``__init__.py`` file in cv2 folder handles the import logic correctly by importing the actual ``.pyd`` module and replacing the imported cv2 package in ``sys.modudes`` with the cv2 module to retain backward compatibility.
......@@ -46,7 +49,21 @@ Linux wheels are built using [manylinux](https://github.com/pypa/python-manylinu
## Versioning
Currently the ``find_version.py`` script searches for the version information from OpenCV sources. The CI build number is then added after the actual OpenCV version to differentiate packages (this repo might have modifications but OpenCV version stays same).
Currently the ``find_version.py`` script searches for the version information from OpenCV sources and appends also a revision number specific to this repository to the version string.
#### Releases
A release is made and uploaded to PyPI when a new tag is pushed to master branch. These tags differentiate packages (this repo might have modifications but OpenCV version stays same) and should be incremented sequentially. In practice, release version numbers look like this:
``cv_major.cv_minor.cv_revision.package_revision`` e.g. ``3.1.0.0``
#### Development builds
Every commit to the master branch of this repo will be built. Possible build artifacts use local version identifiers:
``cv_major.cv_minor.cv_revision+git_hash_of_this_repo`` e.g. ``3.1.0+14a8d39``
These artifacts can't be and will not be uploaded to PyPI.
## Supported Python versions
......
import sys
import os
import subprocess
opencv_version = ""
# dig out the version from OpenCV sources
......@@ -20,5 +22,22 @@ with open(version_file_path, 'r') as f:
opencv_version += words[2]
break
# used in local dev releases
git_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'])
if os.name == 'posix':
version = os.getenv('TRAVIS_TAG', git_hash)
else:
version = os.getenv('APPVEYOR_REPO_TAG_NAME', git_hash)
if version != git_hash:
# tag identifies the build and should be a sequential revision number
opencv_version += ".{}".format(version)
else:
# local version identifier, not to be published on PyPI
opencv_version += "+{}".format(version)
print("Version: ", opencv_version)
with open('cv_version.py', 'w') as f:
f.write('opencv_version = "%s"'%opencv_version)
f.write('opencv_version = "%s"' % opencv_version)
......@@ -16,7 +16,7 @@ for package in pip.get_installed_distributions():
class BinaryDistribution(Distribution):
""" Forces BinaryDistribution. """
def has_ext_modules(asd):
def has_ext_modules(self):
return True
def is_pure(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册