Commit 3f3c98cd authored by Michael Kuron's avatar Michael Kuron
Browse files

Merge branch 'FixPackageRequires' into 'master'

Fix package requires

See merge request pycodegen/lbmpy!66
parents 65b2fd79 43ce20b9
...@@ -16,3 +16,5 @@ _local_tmp ...@@ -16,3 +16,5 @@ _local_tmp
doc/bibtex.json doc/bibtex.json
RELEASE-VERSION RELEASE-VERSION
/db /db
/lbmpy/phasefield/simplex_projection.*.so
/lbmpy/phasefield/simplex_projection.c
\ No newline at end of file
import pyximport try:
import pyximport
pyximport.install(language_level=3)
from lbmpy.phasefield.simplex_projection import simplex_projection_2d # NOQA
except ImportError:
try:
from lbmpy.phasefield.simplex_projection import simplex_projection_2d # NOQA
except ImportError:
raise ImportError("neither pyximport nor binary module simplex_projection_2d available.")
import sympy as sp import sympy as sp
from lbmpy.creationfunctions import create_lb_update_rule from lbmpy.creationfunctions import create_lb_update_rule
from lbmpy.macroscopic_value_kernels import pdf_initialization_assignments from lbmpy.macroscopic_value_kernels import pdf_initialization_assignments
from lbmpy.phasefield.analytical import chemical_potentials_from_free_energy, force_from_phi_and_mu from lbmpy.phasefield.analytical import chemical_potentials_from_free_energy, force_from_phi_and_mu
from lbmpy.phasefield.cahn_hilliard_lbm import cahn_hilliard_lb_method from lbmpy.phasefield.cahn_hilliard_lbm import cahn_hilliard_lb_method
from lbmpy.phasefield.simplex_projection import simplex_projection_2d # NOQA
from lbmpy.stencils import get_stencil from lbmpy.stencils import get_stencil
from pystencils import Assignment, create_data_handling, create_kernel from pystencils import Assignment, create_data_handling, create_kernel
from pystencils.fd import Diff, discretize_spatial, expand_diff_full from pystencils.fd import Diff, discretize_spatial, expand_diff_full
from pystencils.fd.derivation import FiniteDifferenceStencilDerivation from pystencils.fd.derivation import FiniteDifferenceStencilDerivation
pyximport.install(language_level=3)
def forth_order_isotropic_discretize(field): def forth_order_isotropic_discretize(field):
second_neighbor_stencil = [(i, j) second_neighbor_stencil = [(i, j)
......
...@@ -8,12 +8,17 @@ from importlib import import_module ...@@ -8,12 +8,17 @@ from importlib import import_module
sys.path.insert(0, os.path.abspath('doc')) sys.path.insert(0, os.path.abspath('doc'))
try:
import cython # noqa
USE_CYTHON = True
except ImportError:
USE_CYTHON = False
quick_tests = [ quick_tests = [
# 'test_serial_scenarios.test_ldc_mrt', 'test_serial_scenarios.test_ldc_mrt',
'test_serial_scenarios.test_channel_srt', 'test_serial_scenarios.test_channel_srt',
] ]
class SimpleTestRunner(distutils.cmd.Command): class SimpleTestRunner(distutils.cmd.Command):
"""A custom command to run selected tests""" """A custom command to run selected tests"""
...@@ -43,7 +48,6 @@ class SimpleTestRunner(distutils.cmd.Command): ...@@ -43,7 +48,6 @@ class SimpleTestRunner(distutils.cmd.Command):
for test in quick_tests: for test in quick_tests:
self._run_tests_in_module(test) self._run_tests_in_module(test)
try: try:
sys.path.insert(0, os.path.abspath('doc')) sys.path.insert(0, os.path.abspath('doc'))
from version_from_git import version_number_from_git from version_from_git import version_number_from_git
...@@ -54,6 +58,14 @@ try: ...@@ -54,6 +58,14 @@ try:
except ImportError: except ImportError:
version = open('RELEASE-VERSION', 'r').read() version = open('RELEASE-VERSION', 'r').read()
def cython_extensions(*extensions):
from distutils.extension import Extension
ext = '.pyx' if USE_CYTHON else '.c'
result = [Extension(e, [e.replace('.', '/') + ext]) for e in extensions]
if USE_CYTHON:
from Cython.Build import cythonize
result = cythonize(result, language_level=3)
return result
def readme(): def readme():
with open('README.md') as f: with open('README.md') as f:
...@@ -71,6 +83,9 @@ setup(name='lbmpy', ...@@ -71,6 +83,9 @@ setup(name='lbmpy',
url='https://i10git.cs.fau.de/pycodegen/lbmpy/', url='https://i10git.cs.fau.de/pycodegen/lbmpy/',
packages=['lbmpy'] + ['lbmpy.' + s for s in find_packages('lbmpy')], packages=['lbmpy'] + ['lbmpy.' + s for s in find_packages('lbmpy')],
install_requires=['pystencils', 'sympy>=1.2', 'numpy>=1.11.0'], install_requires=['pystencils', 'sympy>=1.2', 'numpy>=1.11.0'],
package_data={'lbmpy': ['phasefield/simplex_projection.pyx',
'phasefield/simplex_projection.c']},
ext_modules=cython_extensions("lbmpy.phasefield.simplex_projection"),
classifiers=[ classifiers=[
'Development Status :: 4 - Beta', 'Development Status :: 4 - Beta',
'Framework :: Jupyter', 'Framework :: Jupyter',
...@@ -89,6 +104,7 @@ setup(name='lbmpy', ...@@ -89,6 +104,7 @@ setup(name='lbmpy',
'ipy_table', 'imageio', 'jupyter', 'pyevtk'], 'ipy_table', 'imageio', 'jupyter', 'pyevtk'],
'doc': ['sphinx', 'sphinx_rtd_theme', 'nbsphinx', 'doc': ['sphinx', 'sphinx_rtd_theme', 'nbsphinx',
'sphinxcontrib-bibtex', 'sphinx_autodoc_typehints', 'pandoc'], 'sphinxcontrib-bibtex', 'sphinx_autodoc_typehints', 'pandoc'],
'phasefield': ['Cython']
}, },
cmdclass={ cmdclass={
'quicktest': SimpleTestRunner 'quicktest': SimpleTestRunner
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment