Skip to content

Commit 1a82ced

Browse files
committed
change versioning schema
1 parent 14a8d39 commit 1a82ced

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
| Platform| Status |
1+
| Platform | Status |
22
| :---: | :---: |
33
| Windows | [![buildstatus](https://ci.appveyor.com/api/projects/status/5kjqpmvll5dwj5jd?svg=true)](https://ci.appveyor.com/project/skvark/opencv-python) |
44
| Manylinux| [![Build Status](https://travis-ci.org/skvark/opencv-python.svg?branch=master)](https://travis-ci.org/skvark/opencv-python) |
55

66
# OpenCV on wheels
77

8+
Unofficial OpenCV packages for Python.
9+
810
Work in progress!
911

1012
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
2628

2729
The project is structured like a normal Python package with a standard ``setup.py`` file. The build process is as follows (see ``appveyor.yml``):
2830

29-
1. Checkout OpenCV (TO DO: pull only latest tag)
31+
1. Checkout repository and submodules
32+
- OpenCV is included as submodule and the version is updated manually when a new has been made
3033
2. Find OpenCV version from the sources
3134
2. Upgrade pip and install numpy for each Python version
3235
3. Build OpenCV
@@ -36,7 +39,7 @@ The project is structured like a normal Python package with a standard ``setup.p
3639
6. Test that the Python versions can import them
3740
7. TO DO: upload the wheels to PyPi
3841

39-
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.
42+
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.
4043

4144
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.
4245

@@ -46,7 +49,21 @@ Linux wheels are built using [manylinux](https://github.com/pypa/python-manylinu
4649

4750
## Versioning
4851

49-
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).
52+
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.
53+
54+
#### Releases
55+
56+
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:
57+
58+
``cv_major.cv_minor.cv_revision.package_revision`` e.g. ``3.1.0.0``
59+
60+
#### Development builds
61+
62+
Every commit to the master branch of this repo will be built. Possible build artifacts use local version identifiers:
63+
64+
``cv_major.cv_minor.cv_revision+git_hash_of_this_repo`` e.g. ``3.1.0+14a8d39``
65+
66+
These artifacts can't be and will not be uploaded to PyPI.
5067

5168
## Supported Python versions
5269

find_version.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import sys
2+
import os
3+
import subprocess
24

35
opencv_version = ""
46
# dig out the version from OpenCV sources
@@ -20,5 +22,22 @@
2022
opencv_version += words[2]
2123
break
2224

25+
# used in local dev releases
26+
git_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'])
27+
28+
if os.name == 'posix':
29+
version = os.getenv('TRAVIS_TAG', git_hash)
30+
else:
31+
version = os.getenv('APPVEYOR_REPO_TAG_NAME', git_hash)
32+
33+
if version != git_hash:
34+
# tag identifies the build and should be a sequential revision number
35+
opencv_version += ".{}".format(version)
36+
else:
37+
# local version identifier, not to be published on PyPI
38+
opencv_version += "+{}".format(version)
39+
40+
print("Version: ", opencv_version)
41+
2342
with open('cv_version.py', 'w') as f:
24-
f.write('opencv_version = "%s"'%opencv_version)
43+
f.write('opencv_version = "%s"' % opencv_version)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class BinaryDistribution(Distribution):
1818
""" Forces BinaryDistribution. """
19-
def has_ext_modules(asd):
19+
def has_ext_modules(self):
2020
return True
2121

2222
def is_pure(self):

0 commit comments

Comments
 (0)