This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
executable file
·125 lines (111 loc) · 4.17 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
from setuptools import setup, find_packages
from setuptools.extension import Extension
from Cython.Build import cythonize
from urllib.parse import urljoin
import numpy
import sys
import os
from beagles.base.constants import APP_NAME
from beagles.base.version import __version__
GITHUB = urljoin('https://github.com/rjdbcm/', APP_NAME)
def module_to_path(module):
module = module.replace('.', '/')
module += '.pyx'
return [module]
NMS = 'beagles.backend.net.frameworks.extensions.nms'
CY_YOLO_FINDBOXES = 'beagles.backend.net.frameworks.extensions.cy_yolo_findboxes'
CY_YOLO2_FINDBOXES = 'beagles.backend.net.frameworks.extensions.cy_yolo2_findboxes'
WINDOWS = 'nt'
MAC = 'darwin'
with open("README.md", "r") as f:
long_description = f.read()
with open('requirements.txt', 'r') as f:
requirements = [x.strip() for x in f.readlines()]
# noinspection SpellCheckingInspection
short_description = 'BEhavioral Annotation and Gesture LEarning Suite'
DESCRIPTION_MIME = 'text/markdown'
if os.name == WINDOWS:
ext_modules = [
Extension(NMS,
sources=module_to_path(NMS),
# libraries=["m"] # Unix-like specific
include_dirs=[numpy.get_include()]
),
Extension(CY_YOLO2_FINDBOXES,
sources=module_to_path(CY_YOLO2_FINDBOXES),
# libraries=["m"] # Unix-like specific
include_dirs=[numpy.get_include()],
extra_compile_args=['/fopenmp'],
extra_link_args=['/fopenmp']
),
Extension(CY_YOLO_FINDBOXES,
sources=module_to_path(CY_YOLO_FINDBOXES),
# libraries=["m"] # Unix-like specific
include_dirs=[numpy.get_include()]
)
]
elif os.name == 'posix':
if sys.platform == MAC:
compile_args = ''
linker_args = ''
else:
# This gives a significant boost to postprocessing time
compile_args = ['-fopenmp', '-funroll-loops']
linker_args = ['-fopenmp']
ext_modules = [
Extension(NMS,
sources=module_to_path(NMS),
libraries=["m"], # Unix-like specific
include_dirs=[numpy.get_include()]
),
Extension(CY_YOLO2_FINDBOXES,
sources=module_to_path(CY_YOLO2_FINDBOXES),
libraries=["m"], # Unix-like specific
include_dirs=[numpy.get_include()],
extra_compile_args=compile_args,
extra_link_args=linker_args
),
Extension(CY_YOLO_FINDBOXES,
sources=module_to_path(CY_YOLO_FINDBOXES),
libraries=["m"], # Unix-like specific
include_dirs=[numpy.get_include()]
)
]
else:
ext_modules = [
Extension(NMS,
sources=module_to_path(NMS),
libraries=["m"] # Unix-like specific
),
Extension(CY_YOLO2_FINDBOXES,
sources=module_to_path(CY_YOLO2_FINDBOXES),
libraries=["m"] # Unix-like specific
),
Extension(CY_YOLO_FINDBOXES,
sources=module_to_path(CY_YOLO_FINDBOXES),
libraries=["m"] # Unix-like specific
)
]
setup(
version=__version__,
name=APP_NAME,
description=short_description,
long_description=long_description,
long_description_content_type=DESCRIPTION_MIME,
license='GPLv3',
url=GITHUB,
packages=find_packages(),
scripts=['BEAGLES.py'],
ext_modules=cythonize(ext_modules),
extras_require={
'darkmode': ["qdarkstyle", "pyobjc"] if sys.platform == MAC else ["qdarkstyle"],
'dev': ["googletrans"]
},
classifiers=["Programming Language :: Cython",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Intended Audience :: Science/Research",
"Development Status :: 2 - Pre-Alpha"],
install_requires=requirements
)