Skip to content

Commit a3cae32

Browse files
committed
remove pypandoc, use .rst formatted README until python packaging supports markdown
1 parent 1f5b2a6 commit a3cae32

File tree

4 files changed

+154
-100
lines changed

4 files changed

+154
-100
lines changed

README.md

-88
This file was deleted.

README.rst

+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
+-------------+------------------+
2+
| Platform | Status |
3+
+=============+==================+
4+
| Windows | |buildstatus| |
5+
+-------------+------------------+
6+
| Manylinux | |Build Status| |
7+
+-------------+------------------+
8+
9+
OpenCV on wheels
10+
================
11+
12+
Unofficial OpenCV packages for Python.
13+
14+
Work in progress!
15+
16+
The aim of this repository is to provide means to package each new
17+
`OpenCV release <https://github.com/Itseez/opencv/releases>`__ for the
18+
most used Python versions and platforms.
19+
20+
At the same time it allows anyone to build a custom version of OpenCV
21+
for any Python version: just fork this repo and modify the build files
22+
and scripts to fit your needs.
23+
24+
Why?
25+
----
26+
27+
1. Installation of OpenCV for Python is pretty hideous:
28+
29+
1. Download OpenCV
30+
2. Find cv2.pyd from the package
31+
32+
- If it exists, copy it to the root of Python site-packages
33+
- If it does not exist for some reason for your setup, you have
34+
to setup the build environment and compile it manually
35+
36+
3. Try to import cv2 and hope it works
37+
38+
2. Everyone should be able to install OpenCV (or any package for that
39+
matter) with pip with a single command without building anything
40+
3. Python `wheels <http://pythonwheels.com/>`__ are nice, we should use
41+
them more
42+
43+
Documentation
44+
-------------
45+
46+
The project is structured like a normal Python package with a standard
47+
``setup.py`` file. The build process is as follows (see
48+
``appveyor.yml``):
49+
50+
1. Checkout repository and submodules
51+
52+
- OpenCV is included as submodule and the version is updated
53+
manually when a new OpenCV release has been made
54+
55+
2. Find OpenCV version from the sources
56+
3. Upgrade pip and install numpy for each Python version
57+
4. Build OpenCV
58+
59+
- tests are disabled, otherwise build time increases too much
60+
61+
5. Copy each ``.pyd/.so`` file to cv2 folder of this project and
62+
generate wheel
63+
6. Install the generated wheels for each Python version
64+
7. Test that the Python versions can import them
65+
8. TO DO: upload the wheels to PyPi
66+
67+
Currently the ``find_version.py`` file parses OpenCV version information
68+
from the OpenCV sources. OpenCV depends on numpy, so ``setup.py`` checks
69+
the numpy version also with the help of pip.
70+
71+
As described earlier, for example the ``.pyd`` file on Windows is
72+
normally copied to site-packages. To avoid polluting the root folder the
73+
``__init__.py`` file in cv2 folder handles the import logic correctly by
74+
importing the actual ``.pyd`` module and replacing the imported cv2
75+
package in ``sys.modudes`` with the cv2 module to retain backward
76+
compatibility.
77+
78+
Licensing
79+
---------
80+
81+
Opencv-python package (scripts in this repository) is available under
82+
MIT license. The OpenCV itself is available under `3-clause BSD
83+
License <https://github.com/opencv/opencv/blob/master/LICENSE>`__
84+
(`LICENSE-3RD-PARTY.txt <https://github.com/skvark/opencv-python/blob/master/LICENSE-3RD-PARTY.txt>`__).
85+
86+
Versioning
87+
----------
88+
89+
Currently the ``find_version.py`` script searches for the version
90+
information from OpenCV sources and appends also a revision number
91+
specific to this repository to the version string.
92+
93+
Releases
94+
~~~~~~~~
95+
96+
A release is made and uploaded to PyPI when a new tag is pushed to
97+
master branch. These tags differentiate packages (this repo might have
98+
modifications but OpenCV version stays same) and should be incremented
99+
sequentially. In practice, release version numbers look like this:
100+
101+
``cv_major.cv_minor.cv_revision.package_revision`` e.g. ``3.1.0.0``
102+
103+
Development builds
104+
~~~~~~~~~~~~~~~~~~
105+
106+
Every commit to the master branch of this repo will be built. Possible
107+
build artifacts use local version identifiers:
108+
109+
``cv_major.cv_minor.cv_revision+git_hash_of_this_repo`` e.g.
110+
``3.1.0+14a8d39``
111+
112+
These artifacts can't be and will not be uploaded to PyPI.
113+
114+
Manylinux wheels
115+
----------------
116+
117+
Linux wheels are built using
118+
`manylinux <https://github.com/pypa/python-manylinux-demo>`__. These
119+
wheels should work out of the box for most of the distros out there
120+
since they are built against an old version of glibc.
121+
122+
Supported Python versions
123+
-------------------------
124+
125+
Windows:
126+
~~~~~~~~
127+
128+
There's a build time limitation (AppVeyor open source builds may take
129+
max. 1 hour) which restricts the supported Python versions to two. As
130+
Python's 2.x releases are slowly approaching legacy state, 2.7.x
131+
releases will be the only supported Python 2 versions on Windows. On
132+
Python 3 side, builds will be run only for the latest release.
133+
134+
However, if you wan't to get some other versions, just fork this repo
135+
and change the dependencies.
136+
137+
Linux
138+
~~~~~
139+
140+
Manylinux wheels are built for all the Python versions which are
141+
supported by the manylinux containers.
142+
143+
OS X
144+
~~~~
145+
146+
TODO
147+
148+
.. |buildstatus| image:: https://ci.appveyor.com/api/projects/status/5kjqpmvll5dwj5jd?svg=true
149+
:target: https://ci.appveyor.com/project/skvark/opencv-python
150+
.. |Build Status| image:: https://travis-ci.org/skvark/opencv-python.svg?branch=master
151+
:target: https://travis-ci.org/skvark/opencv-python

requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
numpy==1.11.1
22
wheel
33
twine
4-
pypandoc

setup.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,12 @@
44
import os
55
import sys
66
import pypandoc
7+
import io
78

89
long_description = ""
910

10-
print("Trying to download pandoc...")
11-
pypandoc.download_pandoc()
12-
13-
try:
14-
long_description = pypandoc.convert('README.md', 'rst')
15-
except OSError as e:
16-
print("Pandoc not found.")
17-
import io
18-
# pandoc is not installed, fallback to using raw contents
19-
with io.open('README.md', encoding="utf-8") as f:
20-
long_description = f.read()
11+
with io.open('README.rst', encoding="utf-8") as f:
12+
long_description = f.read()
2113

2214
# cv_version.py should be generated by running find_version.py
2315
from cv_version import opencv_version

0 commit comments

Comments
 (0)