setup.py 2.08 KB
Newer Older
1
import sys
2
3
from io import open  # for Python 2 (identical to builtin in Python 3)

4
5
6
7
from setuptools import Extension, find_packages, setup

import numpy
from Cython.Distutils import build_ext
8

Kai Chen's avatar
Kai Chen committed
9
install_requires = [
10
11
    'numpy>=1.11.1', 'pyyaml', 'six', 'addict', 'requests', 'opencv-python',
    'Cython'
Kai Chen's avatar
Kai Chen committed
12
]
13
14
15
16
17
18
19
if sys.version_info < (3, 3):
    install_requires.append('backports.shutil_get_terminal_size')
if sys.version_info < (3, 4):
    install_requires.extend(['enum34', 'pathlib'])


def readme():
20
    with open('README.rst', encoding='utf-8') as f:
21
22
23
24
25
26
        content = f.read()
    return content


def get_version():
    version_file = 'mmcv/version.py'
27
    with open(version_file, 'r', encoding='utf-8') as f:
28
29
30
31
        exec(compile(f.read(), version_file, 'exec'))
    return locals()['__version__']


32
33
34
35
36
37
38
EXT_MODULES = [
    Extension(
        name='mmcv._ext',
        sources=[
            './mmcv/video/optflow_warp/flow_warp.cpp',
            './mmcv/video/optflow_warp/flow_warp_module.pyx'
        ],
39
        include_dirs=[numpy.get_include()],
40
41
42
43
        language="c++",
    ),
]

44
45
46
47
48
49
50
51
52
setup(
    name='mmcv',
    version=get_version(),
    description='Open MMLab Computer Vision Foundation',
    long_description=readme(),
    keywords='computer vision',
    packages=find_packages(),
    classifiers=[
        'Development Status :: 4 - Beta',
Kai Chen's avatar
Kai Chen committed
53
        'License :: OSI Approved :: Apache Software License',
54
55
56
57
58
59
60
        'Operating System :: OS Independent',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
61
        'Programming Language :: Python :: 3.7',
62
63
64
65
66
67
68
69
        'Topic :: Utilities',
    ],
    url='https://github.com/open-mmlab/mmcv',
    author='Kai Chen',
    author_email='chenkaidev@gmail.com',
    setup_requires=['pytest-runner'],
    tests_require=['pytest'],
    install_requires=install_requires,
70
71
    ext_modules=EXT_MODULES,
    cmdclass={'build_ext': build_ext},
72
    zip_safe=False)