24
24
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
25
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
26
27
- import io
28
27
import os
29
- import re
30
- from os .path import join
31
- import Cython .Build
32
- from setuptools import setup , Extension
28
+ import sys
33
29
import numpy as np
34
- from _vendored .conv_template import process_file as process_c_file
35
-
36
- with io .open ('mkl_fft/_version.py' , 'rt' , encoding = 'utf8' ) as f :
37
- version = re .search (r'__version__ = \'(.*?)\'' , f .read ()).group (1 )
38
-
39
- with open ("README.md" , "r" , encoding = "utf-8" ) as file :
40
- long_description = file .read ()
30
+ from setuptools import setup , Extension
31
+ import Cython .Build
41
32
42
- VERSION = version
33
+ sys .path .insert (0 , os .path .dirname (__file__ )) # Ensures local imports work
34
+ from _vendored .conv_template import process_file as process_c_file
43
35
44
- CLASSIFIERS = """\
45
- Development Status :: 5 - Production/Stable
46
- Intended Audience :: Science/Research
47
- Intended Audience :: Developers
48
- License :: OSI Approved
49
- Programming Language :: C
50
- Programming Language :: Python
51
- Programming Language :: Python :: 3
52
- Programming Language :: Python :: 3.9
53
- Programming Language :: Python :: 3.10
54
- Programming Language :: Python :: 3.11
55
- Programming Language :: Python :: 3.12
56
- Programming Language :: Python :: Implementation :: CPython
57
- Topic :: Software Development
58
- Topic :: Scientific/Engineering
59
- Operating System :: Microsoft :: Windows
60
- Operating System :: POSIX
61
- Operating System :: Unix
62
- Operating System :: MacOS
63
- """
64
36
65
37
def extensions ():
66
38
mkl_root = os .environ .get ('MKLROOT' , None )
67
- if mkl_root :
68
- mkl_info = {
69
- 'include_dirs' : [join (mkl_root , 'include' )],
70
- 'library_dirs' : [join (mkl_root , 'lib' ), join (mkl_root , 'lib' , 'intel64' )],
71
- 'libraries' : ['mkl_rt' ]
72
- }
73
- else :
74
- try :
75
- mkl_info = get_info ('mkl' )
76
- except :
77
- mkl_info = dict ()
78
-
79
- mkl_include_dirs = mkl_info .get ('include_dirs' , [])
80
- mkl_library_dirs = mkl_info .get ('library_dirs' , [])
81
- mkl_libraries = mkl_info .get ('libraries' , ['mkl_rt' ])
39
+ mkl_include_dirs = [os .path .join (mkl_root , 'include' )] if mkl_root else []
40
+ mkl_library_dirs = [os .path .join (mkl_root , 'lib' ), os .path .join (mkl_root , 'lib' , 'intel64' )] if mkl_root else []
41
+ mkl_libraries = ['mkl_rt' ]
82
42
83
43
mklfft_templ = os .path .join ("mkl_fft" , "src" , "mklfft.c.src" )
84
44
processed_mklfft_fn = os .path .join ("mkl_fft" , "src" , "mklfft.c" )
@@ -90,52 +50,19 @@ def extensions():
90
50
return [
91
51
Extension (
92
52
"mkl_fft._pydfti" ,
93
- [
94
- os .path .join ("mkl_fft" , "_pydfti.pyx" ),
95
- os .path .join ("mkl_fft" , "src" , "mklfft.c" ),
96
- ],
97
- depends = [
98
- os .path .join ("mkl_fft" , "src" , 'mklfft.h' ),
99
- os .path .join ("mkl_fft" , "src" , "multi_iter.h" )
100
- ],
101
- include_dirs = [os .path .join ("mkl_fft" , "src" ), np .get_include ()] + mkl_include_dirs ,
102
- libraries = mkl_libraries ,
103
- library_dirs = mkl_library_dirs ,
104
- extra_compile_args = [
105
- '-DNDEBUG' ,
106
- # '-ggdb', '-O0', '-Wall', '-Wextra', '-DDEBUG',
53
+ sources = [
54
+ "mkl_fft/_pydfti.pyx" ,
55
+ "mkl_fft/src/mklfft.c" ,
107
56
],
108
- define_macros = [("NPY_NO_DEPRECATED_API" , None ), ("PY_ARRAY_UNIQUE_SYMBOL" , "mkl_fft_ext" )]
57
+ include_dirs = ["mkl_fft/src" , np .get_include ()] + mkl_include_dirs ,
58
+ libraries = mkl_libraries ,
59
+ library_dirs = mkl_library_dirs ,
60
+ extra_compile_args = ['-DNDEBUG' ],
61
+ define_macros = [("NPY_NO_DEPRECATED_API" , None ), ("PY_ARRAY_UNIQUE_SYMBOL" , "mkl_fft_ext" )],
109
62
)
110
63
]
111
64
112
-
113
65
setup (
114
- name = "mkl_fft" ,
115
- maintainer = "Intel Corp." ,
116
- maintainer_email = "[email protected] " ,
117
- description = "MKL-based FFT transforms for NumPy arrays" ,
118
- version = version ,
119
- cmdclass = {'build_ext' : Cython .Build .build_ext },
120
- packages = [
121
- "mkl_fft" ,
122
- "mkl_fft.interfaces" ,
123
- ],
124
- package_data = {"mkl_fft" : ["tests/*.py" ]},
125
- include_package_data = True ,
126
66
ext_modules = extensions (),
127
- zip_safe = False ,
128
- long_description = long_description ,
129
- long_description_content_type = "text/markdown" ,
130
- url = "http://github.com/IntelPython/mkl_fft" ,
131
- author = "Intel Corporation" ,
132
- download_url = "http://github.com/IntelPython/mkl_fft" ,
133
- license = "BSD" ,
134
- classifiers = [_f for _f in CLASSIFIERS .split ('\n ' ) if _f ],
135
- platforms = ["Windows" , "Linux" , "Mac OS-X" ],
136
- test_suite = "pytest" ,
137
- python_requires = '>=3.7' ,
138
- setup_requires = ["Cython" ,],
139
- install_requires = ["numpy >=1.16" , "mkl" ],
140
- keywords = ["DFTI" , "FFT" , "Fourier" , "MKL" ,],
67
+ cmdclass = {'build_ext' : Cython .Build .build_ext },
141
68
)
0 commit comments