-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
59 lines (50 loc) · 1.51 KB
/
setup.py
File metadata and controls
59 lines (50 loc) · 1.51 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
program_name = "squarematrix"
version = "0.1.0"
from setuptools import find_packages # Must come before importing "numpy.distutils"
from numpy.distutils.core import setup
from numpy.distutils.extension import Extension
from Cython.Build import cythonize
import shlex
from subprocess import Popen, PIPE
from pathlib import Path
try:
import PyTPSA
print("* PyTPSA is already installed.")
except ImportError:
p = Popen(
shlex.split("pip install git+https://github.com/yhidaka/PyTPSA"),
stdout=PIPE,
stderr=PIPE,
encoding="utf-8",
)
out, err = p.communicate()
print(out)
if err:
print("** stderr **")
print(err)
cython_ext = Extension(f"{program_name}.cytpsa", sources=["src/cytpsa_src/cytpsa.pyx"])
cython_ext.cython_directives = {"language_level": "3"}
fortran_extensions = [
Extension(
f"{program_name}.fortran.{fortran_basename}",
sources=[f"src/fortran_src/{fortran_basename}.f"],
f2py_options=["--quiet"],
)
for fortran_basename in sorted(
[p.stem for p in Path("src/fortran_src").glob("*.f")]
)
]
ext_modules = cythonize([cython_ext]) + fortran_extensions
setup(
name=program_name,
version=version,
packages=find_packages(where="src"),
package_dir={"": "src"},
ext_modules=ext_modules,
zip_safe=False,
description="Square Matrix",
author="Li Hua Yu, Yoshiteru Hidaka",
maintainer="Li Hua Yu",
maintainer_email="lhyu@bnl.gov",
# install_requires=install_requires,
)