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

use only one README, convert README to markdown, update licenses, update setup.py

上级 b1a7fcc3
......@@ -10,7 +10,7 @@ copy or use the software.
For Open Source Computer Vision Library
(3-clause BSD License)
Copyright (C) 2000-2016, Intel Corporation, all rights reserved.
Copyright (C) 2000-2018, Intel Corporation, all rights reserved.
Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved.
Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
......@@ -43,9 +43,44 @@ and on any theory of liability, whether in contract, strict liability,
or tort (including negligence or otherwise) arising in any way out of
the use of this software, even if advised of the possibility of such damage.
------------------------------------------------------------------------------
libvpx is redistributed within opencv-python Linux packages.
This license applies to libvpx binary in the directory cv2/.
Copyright (c) 2010, The WebM Project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Google, nor the WebM Project, nor the names
of its contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
FFmpeg is redistributed within opencv-python Windows packages.
Qt 4.8.7 is redistributed within opencv-python Linux and macOS packages
Qt 4.8.7 is redistributed within opencv-python Linux and macOS packages.
This license applies to FFmpeg and Qt binaries in the directory cv2/.
GNU LESSER GENERAL PUBLIC LICENSE
......
MIT License
Copyright (c) 2016-2017 Olli-Pekka Heinisuo and contributors
Copyright (c) 2016-2018 Olli-Pekka Heinisuo and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
## OpenCV on Wheels
**Unofficial** pre-built OpenCV packages for Python.
### Installation and Usage
1. If you have previous/other manually installed version of OpenCV installed (e.g. cv2 module in the root of Python's site-packages), remove it before installation to avoid conflicts.
2. Select the correct package for your environment:
There are four different packages and you should **select only one of them**. Do not install multiple different packages in the same enviroment.
**a.** Packages for standard desktop environments (Windows, macOS, almost any GNU/Linux distribution)
- run ``pip install opencv-python`` if you need only main modules
- run ``pip install opencv-contrib-python`` if you need both main and contrib modules (check extra modules listing from [OpenCV documentation](https://docs.opencv.org/master/))
**b.** Packages for server (headless) environments
These packages do not contain any GUI functionality. They are smaller and suitable for more restricted environments.
- run ``pip install opencv-python-headless`` if you need only main modules
- run ``pip install opencv-contrib-python-headless`` if you need both main and contrib modules (check extra modules listing from [OpenCV documentation](https://docs.opencv.org/master/))
3. Import the package:
``import cv2``
All packages contain haarcascade files. ``cv2.data.haarcascades`` can be used as a shortcut to the data folder. For example:
``cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml")``
5. Read [OpenCV documentation](https://docs.opencv.org/master/)
6. Before opening a new issue, read the FAQ below and have a look at the other issues which are already open.
Frequently Asked Questions
--------------------------
**Q: Do I need to install also OpenCV separately?**
A: No, the packages are special wheel binary packages and they already contain statically built OpenCV binaries.
**Q: Pip fails with ``Could not find a version that satisfies the requirement ...``?**
A: Most likely the issue is related to too old pip and can be fixed by running ``pip install --upgrade pip``. Note that PyPI does not currently support ARM architecture so you can't install these packages for example on Raspberry Pi.
**Q: Import fails on Windows: ``ImportError: DLL load failed: The specified module could not be found.``?**
A: If the import fails on Windows, make sure you have [Visual C++ redistributable 2015](https://www.microsoft.com/en-us/download/details.aspx?id=48145) installed. If you are using older Windows version than Windows 10 and latest system updates are not installed, [Universal C Runtime](https://support.microsoft.com/en-us/help/2999226/update-for-universal-c-runtime-in-windows) might be also required.
If the above does not help, check if you are using Anaconda. Old Anaconda versions have a bug which causes the error, see [this issue](https://github.com/skvark/opencv-python/issues/36) for a manual fix.
**Q: I have some other import errors?**
A: Make sure you have removed old manual installations of OpenCV Python bindings (cv2.so or cv2.pyd in site-packages).
## Documentation for opencv-python
.. image:: https://img.shields.io/appveyor/ci/skvark/opencv-python.svg?maxAge=3600&label=Windows
:target: https://ci.appveyor.com/project/skvark/opencv-python
:alt: AppVeyor CI test status (Windows)
.. image:: https://img.shields.io/travis/skvark/opencv-python.svg?maxAge=3600&label="Linux / OS X"
:target: https://travis-ci.org/skvark/opencv-python
:alt: Travis CI test status (Linux and OS X)
The aim of this repository is to provide means to package each new [OpenCV release](https://github.com/opencv/opencv/releases>) for the most used Python versions and platforms.
### Build process
The project is structured like a normal Python package with a standard ``setup.py`` file. The build process for a single entry in the build matrices is as follows (see for example ``appveyor.yml`` file):
1. Checkout repository and submodules
- OpenCV is included as submodule and the version is updated
manually by maintainers when a new OpenCV release has been made
- Contrib modules are also included as a submodule
2. Find OpenCV version from the sources
3. Install dependencies (numpy)
4. Build OpenCV
- tests are disabled, otherwise build time increases too much
- there are 4 build matrix entries for each build combination: with and without contrib modules, with and without GUI (headless)
- Linux builds run in manylinux Docker containers (CentOS 5)
5. Copy each ``.pyd/.so`` file to cv2 folder of this project and
generate wheel
- Linux and macOS wheels are checked with auditwheel and delocate
6. Install the generated wheel
7. Test that Python can import the library and run some sanity checks
8. Use twine to upload the generated wheel to PyPI (only in release builds)
The ``cv2.pyd/.so`` file is normally copied to site-packages. To avoid polluting the root folder this package wraps the statically built binary into cv2 package and ``__init__.py`` file in the package handles the import logic correctly.
Since all packages use the same ``cv2`` namespace explained above, uninstall the other package before switching for example from ``opencv-python`` to ``opencv-contrib-python``.
### Licensing
Opencv-python package (scripts in this repository) is available under MIT license.
OpenCV itself is available under [3-clause BSD License](https://github.com/opencv/opencv/blob/master/LICENSE).
Third party package licenses are at [LICENSE-3RD-PARTY.txt](https://github.com/skvark/opencv-python/blob/master/LICENSE-3RD-PARTY.txt).
All wheels ship with [FFmpeg](http://ffmpeg.org) licensed under the [LGPLv2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html).
Linux and MacOS wheels ship with [Qt 4.8.7](http://doc.qt.io/qt-4.8/lgpl.html) licensed under the [LGPLv2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html).
### Versioning
``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.
### Manylinux wheels
Linux wheels are built using [manylinux](https://github.com/pypa/python-manylinux-demo). These wheels should work out of the box for most of the distros (which use GNU C standard library) out there since they are built against an old version of glibc.
The default ``manylinux`` images have been extended with some OpenCV dependencies. See [Docker folder](https://github.com/skvark/opencv-python/tree/master/docker) for more info.
### Supported Python versions
Python 2.7 is the only supported version in 2.x series. Python 3.x releases follow Numpy releases. For example Python 3.3 is no longer supported by Numpy so support for it has been dropped in ``opencv-python``, too.
Currently, builds for following Python versions are provided:
- 2.7
- 3.4
- 3.5
- 3.6
OpenCV on Wheels
================
**Unofficial** OpenCV packages for Python.
This package contains only the OpenCV core modules without the optional contrib modules.
If you are looking for a version which includes OpenCV contrib modules, please install `opencv-contrib-python <https://pypi.python.org/pypi/opencv-contrib-python>`__ instead.
The packages contain pre-compiled OpenCV binary with Python bindings.
This enables super fast (usually < 10 seconds) OpenCV installation for Python.
If you need only OpenCV Python bindings, no separate OpenCV installation is required.
Installation and Usage
----------------------
1. If you have previous/other version of OpenCV installed (e.g. cv2 module in the root of Python's site-packages), remove it before installation to avoid conflicts.
- To further avoid conflicts and to make development easier, Python's `virtual environments <https://docs.python.org/3/library/venv.html>`__ are highly recommended for development purposes.
2. If you have an existing ``opencv-contrib-python`` installation, run ``pip uninstall opencv-contrib-python``
3. Install this package:
``pip install opencv-python``
4. Import the package:
``import cv2``
The package contains haarcascade files. ``cv2.data.haarcascades`` can be used as a shortcut to the data folder. For example:
``cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml")``
5. Read `OpenCV documentation <http://docs.opencv.org/>`__
6. Before opening a new issue, read the FAQ below and have a look at the other issues which are already open.
Frequently Asked Questions
--------------------------
**Q: Do I need to install also OpenCV separately?**
A: No, the packages are special wheel binary packages and they already contain statically built OpenCV binaries.
**Q: Pip does not find package ``opencv-python``?**
A: The wheel package format and manylinux builds are pretty new things. Most likely the issue is related to too old pip and can be fixed by running ``pip install --upgrade pip`` and ``pip install wheel``.
**Q: I need contrib modules?**
A: Please install `opencv-contrib-python <https://pypi.python.org/pypi/opencv-contrib-python>`__ instead. However, note that commercial usage might be restricted in some countries since the contrib modules might contain some non-free/patented algorithms.
**Q: Import fails on Windows to some DLL load error?**
A: If the import fails on Windows, make sure you have `Visual C++ redistributable 2015 <https://www.microsoft.com/en-us/download/details.aspx?id=48145>`__ installed. If you are using older Windows version than Windows 10 and latest system updates are not installed, `Universal C Runtime <https://support.microsoft.com/en-us/help/2999226/update-for-universal-c-runtime-in-windows>`__ might be also required.
See also `this issue <https://github.com/skvark/opencv-python/issues/36>`__ if you are using Anaconda.
**Q: I have some other import errors?**
A: Make sure you have removed old manual installations of OpenCV Python bindings (cv2.so or cv2.pyd in site-packages).
Documentation for opencv-python
-------------------------------
.. image:: https://img.shields.io/appveyor/ci/skvark/opencv-python.svg?maxAge=3600&label=Windows
:target: https://ci.appveyor.com/project/skvark/opencv-python
:alt: AppVeyor CI test status (Windows)
.. image:: https://img.shields.io/travis/skvark/opencv-python.svg?maxAge=3600&label="Linux / OS X"
:target: https://travis-ci.org/skvark/opencv-python
:alt: Travis CI test status (Linux and OS X)
The aim of this repository is to provide means to package each new
`OpenCV release <https://github.com/opencv/opencv/releases>`__ for the
most used Python versions and platforms.
At the same time it allows anyone to build a custom version of OpenCV
for any Python version: just fork this repo and modify the build files
and scripts to fit your needs.
Build process
-------------
The project is structured like a normal Python package with a standard
``setup.py`` file. The build process for a single entry in the build matrices is as follows (see for example
``appveyor.yml`` file):
1. Checkout repository and submodules
- OpenCV is included as submodule and the version is updated
manually by maintainers when a new OpenCV release has been made
- Contrib modules are also included as a submodule
2. Find OpenCV version from the sources
3. Install dependencies (numpy)
4. Build OpenCV
- tests are disabled, otherwise build time increases too much
- there are 2 build matrix entries for each build combination: with and without contrib modules
- Linux builds run in manylinux Docker containers (CentOS 5)
5. Copy each ``.pyd/.so`` file to cv2 folder of this project and
generate wheel
- Linux and macOS wheels are checked with auditwheel and delocate
6. Install the generated wheel
7. Test that Python can import the library and run some sanity checks
8. Use twine to upload the generated wheel to PyPI (only in release builds)
Currently the ``find_version.py`` file parses OpenCV version information
from the OpenCV sources. OpenCV depends on numpy, so ``setup.py`` checks
the minimum required numpy version also with the help of pip.
The ``cv2.pyd/.so`` file is normally copied to site-packages.
To avoid polluting the root folder this package wraps
the statically built binary into cv2 package and ``__init__.py``
file in the package handles the import logic correctly.
Since both ``opencv-python`` and ``opencv-contrib-python`` use the same namespace explained above,
it is highly recommended to uninstall the other package before switching from example from
``opencv-python`` to ``opencv-contrib-python`` package.
Licensing
---------
Opencv-python package (scripts in this repository) is available under
MIT license.
OpenCV itself is available under `3-clause BSD
License <https://github.com/opencv/opencv/blob/master/LICENSE>`__
(`LICENSE-3RD-PARTY.txt <https://github.com/skvark/opencv-python/blob/master/LICENSE-3RD-PARTY.txt>`__).
All wheels ship with `FFmpeg <http://ffmpeg.org>`__ licensed under the `LGPLv2.1 <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>`__.
Linux and MacOS wheels ship with `Qt 4.8.7 <http://doc.qt.io/qt-4.8/lgpl.html>`__ licensed under the `LGPLv2.1 <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>`__.
Versioning
----------
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.
Manylinux wheels
----------------
Linux wheels are built using
`manylinux <https://github.com/pypa/python-manylinux-demo>`__. These
wheels should work out of the box for most of the distros
(which use GNU C standard library) out there since they are built
against an old version of glibc.
Supported Python versions
-------------------------
Python 2.7 is the only supported version in 2.x series.
Python 3.x releases follow Numpy releases, for example
Python 3.3 is no longer supported by Numpy so the support
for it has been dropped in ``opencv-python`` too.
Currently, builds for following Python versions are provided:
- 2.7
- 3.4
- 3.5
- 3.6
OpenCV on Wheels
================
**Unofficial** OpenCV packages for Python with contrib modules.
**Note: the (commercial) usage of opencv-contrib-python might be restricted in some countries since the contrib package might contain some patented algorithms/non-free modules.**
If you are looking for a version without the contrib modules, please install `opencv-python <https://pypi.python.org/pypi/opencv-python>`__ instead.
The packages contain pre-compiled OpenCV binary with Python bindings.
This enables super fast (usually < 10 seconds) OpenCV installation for Python.
If you need only OpenCV Python bindings, no separate OpenCV installation is required.
Installation and Usage
----------------------
1. If you have previous/other version of OpenCV installed (e.g. cv2 module in the root of Python's site-packages), remove it before installation to avoid conflicts.
- To further avoid conflicts and to make development easier, Python's `virtual environments <https://docs.python.org/3/library/venv.html>`__ are highly recommended for development purposes.
2. If you have an existing ``opencv-python`` installation, run ``pip uninstall opencv-python``
3. Install this package:
``pip install opencv-contrib-python``
4. Import the package:
``import cv2``
The package contains haarcascade files. ``cv2.data.haarcascades`` can be used as a shortcut to the data folder. For example:
``cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml")``
5. Read `OpenCV documentation <http://docs.opencv.org/>`__
6. Before opening a new issue, read the FAQ below and have a look at the other issues which are already open.
Frequently Asked Questions
--------------------------
**Q: Do I need to install also OpenCV separately?**
A: No, the packages are special wheel binary packages and they already contain statically built OpenCV binaries.
**Q: Pip does not find package opencv-contrib-python?**
A: The wheel package format and manylinux builds are pretty new things. Most likely the issue is related to too old pip and can be fixed by running ``pip install --upgrade pip`` and ``pip install wheel``.
**Q: Import fails on Windows to some DLL load error?**
A: If the import fails on Windows, make sure you have `Visual C++ redistributable 2015 <https://www.microsoft.com/en-us/download/details.aspx?id=48145>`__ installed. If you are using older Windows version than Windows 10 and latest system updates are not installed, `Universal C Runtime <https://support.microsoft.com/en-us/help/2999226/update-for-universal-c-runtime-in-windows>`__ might be also required.
See also `this issue <https://github.com/skvark/opencv-python/issues/36>`__ if you are using Anaconda.
**Q: I have some other import errors?**
A: Make sure you have removed old manual installations of OpenCV Python bindings (cv2.so or cv2.pyd in site-packages).
Documentation for opencv-python
-------------------------------
.. image:: https://img.shields.io/appveyor/ci/skvark/opencv-python.svg?maxAge=3600&label=Windows
:target: https://ci.appveyor.com/project/skvark/opencv-python
:alt: AppVeyor CI test status (Windows)
.. image:: https://img.shields.io/travis/skvark/opencv-python.svg?maxAge=3600&label="Linux / OS X"
:target: https://travis-ci.org/skvark/opencv-python
:alt: Travis CI test status (Linux and OS X)
The aim of this repository is to provide means to package each new
`OpenCV release <https://github.com/opencv/opencv/releases>`__ for the
most used Python versions and platforms.
At the same time it allows anyone to build a custom version of OpenCV
for any Python version: just fork this repo and modify the build files
and scripts to fit your needs.
Build process
-------------
The project is structured like a normal Python package with a standard
``setup.py`` file. The build process for a single entry in the build matrices is as follows (see for example
``appveyor.yml`` file):
1. Checkout repository and submodules
- OpenCV is included as submodule and the version is updated
manually by maintainers when a new OpenCV release has been made
- Contrib modules are also included as a submodule
2. Find OpenCV version from the sources
3. Install dependencies (numpy)
4. Build OpenCV
- tests are disabled, otherwise build time increases too much
- there are 2 build matrix entries for each build combination: with and without contrib modules
- Linux builds run in manylinux Docker containers (CentOS 5)
5. Copy each ``.pyd/.so`` file to cv2 folder of this project and
generate wheel
- Linux and macOS wheels are checked with auditwheel and delocate
6. Install the generated wheel
7. Test that python can import the library and run some sanity checks
8. Use twine to upload the generated wheel to PyPI (only in release builds)
Currently the ``find_version.py`` file parses OpenCV version information
from the OpenCV sources. OpenCV depends on numpy, so ``setup.py`` checks
the minimum required numpy version also with the help of pip.
The ``cv2.pyd/.so`` file is normally copied to site-packages.
To avoid polluting the root folder this package wraps
the statically built binary into cv2 package and ``__init__.py``
file in the package handles the import logic correctly.
Since both ``opencv-python`` and ``opencv-python-contrib`` use the same namespace explained above,
it is highly recommended to uninstall the other package before switching from example from
``opencv-python`` to ``opencv-python-contrib`` package.
Licensing
---------
Opencv-python package (scripts in this repository) is available under
MIT license.
OpenCV itself is available under `3-clause BSD
License <https://github.com/opencv/opencv/blob/master/LICENSE>`__
(`LICENSE-3RD-PARTY.txt <https://github.com/skvark/opencv-python/blob/master/LICENSE-3RD-PARTY.txt>`__).
All wheels ship with `FFmpeg <http://ffmpeg.org>`__ licensed under the `LGPLv2.1 <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>`__.
Linux and MacOS wheels ship with `Qt 4.8.7 <http://doc.qt.io/qt-4.8/lgpl.html>`__ licensed under the `LGPLv2.1 <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>`__.
Versioning
----------
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.
Manylinux wheels
----------------
Linux wheels are built using
`manylinux <https://github.com/pypa/python-manylinux-demo>`__. These
wheels should work out of the box for most of the distros
(which use GNU C standard library) out there since they are built
against an old version of glibc.
Supported Python versions
-------------------------
Python 2.7 is the only supported version in 2.x series.
Python 3.x releases follow Numpy releases, for example
Python 3.3 is no longer supported by Numpy so the support
for it has been dropped in ``opencv-python`` too.
Currently, builds for following Python versions are provided:
- 2.7
- 3.4
- 3.5
- 3.6
......@@ -51,10 +51,11 @@ def main():
if build_headless and not build_contrib:
package_name = "opencv-python-headless"
long_description = io.open('README_CONTRIB.rst' if build_contrib else 'README.rst', encoding="utf-8").read()
long_description = io.open('README.md', encoding="utf-8").read()
package_version = get_opencv_version()
packages = ['cv2', 'cv2.data']
package_data = {
'cv2':
['*%s' % sysconfig.get_config_var('SO')] +
......@@ -67,11 +68,13 @@ def main():
# Files from CMake output to copy to package.
# Path regexes with forward slashes relative to CMake install dir.
rearrange_cmake_output_data = {
'cv2': ([r'bin/opencv_ffmpeg\d{3}%s\.dll' % ('_64' if x64 else '')] if os.name == 'nt' else []) +
# In Windows, in python/X.Y/<arch>/; in Linux, in just python/X.Y/.
# Naming conventions vary so widely between versions and OSes
# had to give up on checking them.
['python/([^/]+/){1,2}cv2[^/]*%(ext)s' % {'ext': re.escape(sysconfig.get_config_var('SO'))}],
# In Windows, in python/X.Y/<arch>/; in Linux, in just python/X.Y/.
# Naming conventions vary so widely between versions and OSes
# had to give up on checking them.
['python/([^/]+/){1,2}cv2[^/]*%(ext)s' % {'ext': re.escape(sysconfig.get_config_var('SO'))}],
'cv2.data': [ # OPENCV_OTHER_INSTALL_PATH
('etc' if os.name == 'nt' else 'share/OpenCV') +
r'/haarcascades/.*\.xml'
......@@ -150,6 +153,7 @@ def main():
license='MIT',
description='Wrapper package for OpenCV python bindings.',
long_description=long_description,
long_description_content_type="text/markdown",
packages=packages,
package_data=package_data,
maintainer="Olli-Pekka Heinisuo",
......@@ -196,8 +200,7 @@ class RearrangeCMakeOutput(object):
# Have to wrap a function reference, or it's converted
# into an instance method on attr assignment
import argparse
wraps = argparse.Namespace(
_classify_files=None)
wraps = argparse.Namespace(_classify_files=None)
del argparse
package_paths_re = None
......@@ -253,6 +256,7 @@ class RearrangeCMakeOutput(object):
final_install_relpaths = []
print("Copying files from CMake output")
for package_name, relpaths_re in cls.package_paths_re.items():
package_dest_reldir = package_name.replace('.', os.path.sep)
for relpath_re in relpaths_re:
......@@ -278,6 +282,7 @@ class RearrangeCMakeOutput(object):
del relpaths_zip
print("Copying files from non-default sourcetree locations")
for package_name, paths in cls.files_outside_package.items():
package_dest_reldir = package_name.replace('.', os.path.sep)
for path in paths:
......@@ -288,7 +293,7 @@ class RearrangeCMakeOutput(object):
os.path.basename(path))
cls._setuptools_wrap._copy_file(
path, os.path.join(cmake_install_dir, new_install_relpath),
hide_listing = False
hide_listing=False
)
final_install_relpaths.append(new_install_relpath)
......@@ -337,7 +342,7 @@ def get_build_env_var_by_name(flag_name):
def get_or_install(name, version=None):
"""If a package is already installed, build against it. If not, install"""
""" If a package is already installed, build against it. If not, install """
# Do not import 3rd-party modules into the current process
import json
js_packages = json.loads(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册