setup.py 2.4 KB
Newer Older
O
Olli-Pekka Heinisuo 已提交
1
from setuptools import setup
2 3
from setuptools.dist import Distribution
import pip
O
Olli-Pekka Heinisuo 已提交
4 5
import os
import sys
6 7 8 9
import pypandoc

long_description = ""

10 11
print("Trying to download pandoc...")
pypandoc.download_pandoc()
O
Olli-Pekka Heinisuo 已提交
12 13 14 15

try:
    long_description = pypandoc.convert('README.md', 'rst')
except OSError as e:
16 17 18 19 20
    print("Pandoc not found.")
    import io
    # pandoc is not installed, fallback to using raw contents
    with io.open('README.md', encoding="utf-8") as f:
        long_description = f.read()
O
Olli-Pekka Heinisuo 已提交
21

22 23
# cv_version.py should be generated by running find_version.py
from cv_version import opencv_version
24

25 26 27 28 29 30 31 32 33
numpy_version = ""

# Get required numpy version
for package in pip.get_installed_distributions():
    if package.key == "numpy":
        numpy_version = package.version

class BinaryDistribution(Distribution):
    """ Forces BinaryDistribution. """
O
Olli-Pekka Heinisuo 已提交
34
    def has_ext_modules(self):
35 36
        return True

37 38 39
    def is_pure(self):
        return False

O
Olli-Pekka Heinisuo 已提交
40 41 42
package_data = {}

if os.name == 'posix':
O
fixes  
Olli-Pekka Heinisuo 已提交
43
    package_data['cv2'] = ['*.so']
O
Olli-Pekka Heinisuo 已提交
44
else:
O
fixes  
Olli-Pekka Heinisuo 已提交
45
    package_data['cv2'] = ['*.pyd']
O
Olli-Pekka Heinisuo 已提交
46 47 48

setup(name='opencv-python',
      version=opencv_version,
49 50 51 52
      url='https://github.com/skvark/opencv-python',
      license='MIT',
      description='Wrapper package for OpenCV python bindings.',
      long_description = long_description,
53
      distclass=BinaryDistribution,
O
Olli-Pekka Heinisuo 已提交
54 55
      packages=['cv2'],
      package_data=package_data,
56
      maintainer="Olli-Pekka Heinisuo",
57
      include_package_data=True,
58
      install_requires="numpy==%s" % numpy_version,
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
      classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Environment :: Console',
        'Intended Audience :: Developers',
        'Intended Audience :: Education',
        'Intended Audience :: Information Technology',
        'Intended Audience :: Science/Research',
        'License :: OSI Approved :: MIT License',
        'Operating System :: MacOS',
        'Operating System :: Microsoft :: Windows',
        'Operating System :: POSIX',
        'Operating System :: Unix',
        'Programming Language :: Python',
        'Programming Language :: C++',
        'Programming Language :: Python :: Implementation :: CPython',
        'Topic :: Scientific/Engineering',
        'Topic :: Scientific/Engineering :: Image Recognition',
        'Topic :: Software Development',
        ]
O
Olli-Pekka Heinisuo 已提交
78
      )