-
Notifications
You must be signed in to change notification settings - Fork 7
/
setup.py
101 lines (93 loc) · 4.59 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
from distutils.core import setup
import re
from distutils.extension import Extension
import numpy as np
def get_cython_version():
"""
Returns:
Version as a pair of ints (major, minor)
Raises:
ImportError: Can't load cython or find version
"""
import Cython.Compiler.Main
match = re.search('^([0-9]+)\.([0-9]+)',
Cython.Compiler.Main.Version.version)
try:
return map(int, match.groups())
except AttributeError:
raise ImportError
# Only use Cython if it is available, else just use the pre-generated files
try:
cython_version = get_cython_version()
# Requires Cython version 0.13 and up
if cython_version[0] == 0 and cython_version[1] < 13:
raise ImportError
from Cython.Distutils import build_ext
source_ext = '.pyx'
cmdclass = {'build_ext': build_ext}
except ImportError:
source_ext = '.c'
cmdclass = {}
ext_modules = [Extension("_imfeat",
["imfeat/imfeat" + source_ext],
extra_compile_args=['-I', np.get_include()]),
Extension("_imfeat_conversion",
["imfeat/_conversion" + source_ext],
extra_compile_args=['-I', np.get_include()]),
Extension("_imfeat_histogram",
["imfeat/_histogram/histogram" + source_ext,
'imfeat/_histogram/histogram_aux.c'],
extra_compile_args=['-I', np.get_include()],
include_dirs=['imfeat']),
Extension("_imfeat_dedupe",
["imfeat/_dedupe/dedupe" + source_ext,
'imfeat/_dedupe/dedupe_aux.c'],
extra_compile_args=['-I', np.get_include()],
include_dirs=['imfeat']),
Extension("_imfeat_autocorrelogram",
["imfeat/_autocorrelogram/autocorrelogram" + source_ext,
'imfeat/_autocorrelogram/Autocorrelogram.cpp'],
extra_compile_args=['-I', np.get_include()]),
Extension("_imfeat_rhog",
["imfeat/_rhog/rhog" + source_ext,
'imfeat/_rhog/rhog_aux.c'],
extra_compile_args=['-I', np.get_include()]),
Extension("_imfeat_block_generator",
["imfeat/block_generator" + source_ext],
extra_compile_args=['-I', np.get_include()]),
Extension("_imfeat_bovw",
["imfeat/_bovw/bovw" + source_ext, 'imfeat/_bovw/bovw_aux.c'],
extra_compile_args=['-I', np.get_include()]),
Extension("_imfeat_pyramid_histogram",
["imfeat/_pyramid_histogram/pyramid_histogram" + source_ext, 'imfeat/_pyramid_histogram/pyramid_histogram_aux.c'],
extra_compile_args=['-I', np.get_include()]),
Extension("_imfeat_moments",
["imfeat/moments" + source_ext],
extra_compile_args=['-I', np.get_include()]),
Extension("_imfeat_hog_latent",
["imfeat/_hog_latent/hog_latent" + source_ext,
'imfeat/_hog_latent/features.cc',
'imfeat/_hog_latent/resize.cc'],
extra_compile_args=['-I', np.get_include()]),
Extension("_imfeat_lbp",
["imfeat/_lbp/lbp" + source_ext,
'imfeat/_lbp/lbp_aux.c'],
extra_compile_args=['-I', np.get_include()]),
Extension("_imfeat_gist",
["imfeat/_gist/gist_cython" + source_ext,
'imfeat/_gist/gist.c',
'imfeat/_gist/gist_wrapper.c',
'imfeat/_gist/standalone_image.c'],
extra_compile_args=['-I', np.get_include(), '-D', 'USE_GIST',
'-D', 'STANDALONE_GIST'],
extra_link_args=['-l', 'fftw3f'])]
for e in ext_modules:
e.pyrex_directives = {"embedsignature": True}
setup(name='imfeat',
cmdclass=cmdclass,
version='.01',
packages=['imfeat', 'imfeat._rhog_dalal',
'imfeat._faces', 'imfeat._object_bank', 'imfeat._texton', 'imfeat._color_naming'],
package_data={'imfeat._faces': ['data/*'], 'imfeat._color_naming': ['data/*'],
'imfeat._object_bank': ['data/OBmain', 'data/models/*']},
ext_modules=ext_modules)