-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·78 lines (64 loc) · 2.66 KB
/
setup.py
File metadata and controls
executable file
·78 lines (64 loc) · 2.66 KB
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014–2025, Sergio Callegari
# All rights reserved.
# This file is part of PyDSM.
# PyDSM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# PyDSM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with PyDSM. If not, see <http://www.gnu.org/licenses/>.
import sys
from setuptools import setup, Extension
from Cython.Build import cythonize
import platform
import numpy as np
import re
if sys.version_info[:2] < (3, 10):
raise RuntimeError("Python 3 supported for versions >= 3.10")
link_prefix = r"https://github.com/sergiocallegari/PyDSM/blob/main/"
def to_abs_links(text):
return re.sub(
r"\]\((?!https?://)(.*?)\)",
rf"]({link_prefix}\1)",
text
)
# Create readme file for PyPI
with open("README.md", encoding="utf-8") as f:
readme_text = f.read()
readme_pypi_text = to_abs_links(readme_text)
with open("README-PyPI.md", "w", encoding="utf-8") as f:
f.write(readme_pypi_text)
# Prepare the extension modules
ext_modules = cythonize([
Extension(name='pydsm.delsig._simulateDSM_cblas',
sources=['src/pydsm/delsig/_simulateDSM_cblas.pyx'],
include_dirs=[np.get_include()]+["/usr/include/openblas/"],
libraries=['blas'],
define_macros=[('NPY_NO_DEPRECATED_API',
'NPY_1_7_API_VERSION')]),
Extension(name='pydsm.delsig._simulateDSM_scipy_blas',
sources=['src/pydsm/delsig/_simulateDSM_scipy_blas.pyx'],
include_dirs=[np.get_include()],
define_macros=[('NPY_NO_DEPRECATED_API',
'NPY_1_7_API_VERSION')])],
compiler_directives={'language_level' : "3"})
# Special requirements for the windows platform
if platform.system() != 'Linux':
# The cblas simulator is only built in Linux
ext_modules = [
Extension(name='pydsm.delsig._simulateDSM_scipy_blas',
sources=['src/pydsm/delsig/_simulateDSM_scipy_blas.pyx'],
include_dirs=[np.get_include()],
define_macros=[('NPY_NO_DEPRECATED_API',
'NPY_1_7_API_VERSION')])]
setup(
name='pydsm',
setup_requires=["setuptools_scm"],
ext_modules=ext_modules,
)