-
Notifications
You must be signed in to change notification settings - Fork 24
/
setup.py
96 lines (77 loc) · 2.75 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import platform
from setuptools import dist
dist.Distribution().fetch_build_eggs(['cython','numpy'])
import os
import glob
import shutil
import numpy as np
from setuptools import setup, find_packages, Extension
from setuptools.command.install import install
from distutils.cmd import Command
EXTRA_COMPILE_ARGS = dict(
linux=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
windows=[])
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
class InstallCommand(install):
description = "Builds the package"
def initialize_options(self):
install.initialize_options(self)
def finalize_options(self):
install.finalize_options(self)
def run(self):
install.run(self)
class CleanCommand(Command):
"""Custom clean command to tidy up the project root."""
PY_CLEAN_FILES = ['./build', './dist', './__pycache__', './*.pyc', './*.tgz', './*.egg-info', './.eggs']
description = "Command to tidy up the project root"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
root_dir = os.path.dirname(os.path.realpath(__file__))
for path_spec in self.PY_CLEAN_FILES:
# Make paths absolute and relative to this path
abs_paths = glob.glob(os.path.normpath(os.path.join(root_dir, path_spec)))
for path in [str(p) for p in abs_paths]:
if not path.startswith(root_dir):
# Die if path in CLEAN_FILES is absolute + outside this directory
raise ValueError("%s is not a path inside %s" % (path, root_dir))
print('Removing %s' % os.path.relpath(path))
shutil.rmtree(path)
ext_modules = [
Extension(
'volkscv.utils.cocoapi.pycocotools._mask',
sources=['volkscv/utils/cocoapi/common/maskApi.c',
'volkscv/utils/cocoapi/pycocotools/_mask.pyx'],
include_dirs=[np.get_include(), 'volkscv/utils/cocoapi/common'],
extra_compile_args=EXTRA_COMPILE_ARGS[platform.system().lower()],
)
]
setup(
name='volkscv',
version='1.1.2',
packages=find_packages(),
url='https://github.com/Media-Smart/volkscv',
author='chwang, jsun, yxzou, hxcai, ycxiong',
author_email='[email protected], [email protected]',
description='A foundational python library for computer vision research and deployment projects',
long_description=read('README.md'),
install_requires=[
'cython',
'torch',
'matplotlib>=2.1.0',
'scipy',
'opencv-python',
'lxml',
'cytoolz',
],
ext_modules=ext_modules,
python_requires='>3.6',
cmdclass={
'clean': CleanCommand,
},
zip_safe=False,
)