forked from pmgbergen/porepy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
80 lines (63 loc) · 2.37 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
#!/usr/bin/env python
import os.path
from glob import glob
from os.path import basename, splitext
from setuptools import find_packages, setup
# ---------------------- Cython compilation
# Build cython extensions as part of setup. Based on
# https://stackoverflow.com/questions/4505747/how-should-i-structure-a-python-package-that-contains-cython-code
USE_CYTHON = True
from distutils.core import setup
from distutils.extension import Extension
if USE_CYTHON:
try:
# Trick from
# https://stackoverflow.com/questions/19919905/how-to-bootstrap-numpy-installation-in-setup-py
from Cython.Distutils import build_ext as _build_ext
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
__builtins__.__NUMPY_SETUP__ = False
import numpy
self.include_dirs.append(numpy.get_include())
except:
# Cython is apparently not available on the system. Make do without it
USE_CYTHON = False
cmdclass = {}
ext_modules = []
# New Cython modules must be registered here
if USE_CYTHON:
ext_modules += [
Extension(
"porepy.numerics.fv.cythoninvert",
["src/porepy/numerics/fv/invert_diagonal_blocks.pyx"],
)
]
cmdclass.update({"build_ext": build_ext})
# --------------------- End of cython part
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
with open("requirements.txt") as f:
required = f.read().splitlines()
long_description = read("Readme.rst")
setup(
name="porepy",
version="0.5.0",
license="GPL",
keywords=["porous media simulation fractures deformable"],
author="Eirik Keilegavlen, Runar Berge, Alessio Fumagalli, Michele Starnoni, Ivar Stefansson and Jhabriel Varela",
install_requires=required,
description="Simulation tool for fractured and deformable porous media",
long_description=long_description,
maintainer="Eirik Keilegavlen",
maintainer_email="[email protected]",
platforms=["Linux", "Windows"],
packages=find_packages("src"),
package_dir={"": "src"},
py_modules=[
os.path.splitext(os.path.basename(path))[0] for path in glob("src/*.py")
],
cmdclass=cmdclass,
ext_modules=ext_modules,
)