Skip to content

Commit 20a8cd9

Browse files
committed
cleaned up for manylinux
1 parent 89160b5 commit 20a8cd9

File tree

7 files changed

+54
-676
lines changed

7 files changed

+54
-676
lines changed

setup.py

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,61 @@
11
import os
2+
import sys
23
import numpy
34
from setuptools import setup, Extension
4-
from setuptools.command.build_ext import build_ext
5+
from setuptools.command.build_ext import build_ext as _build_ext
56
from io import open as io_open
67

8+
if sys.version_info[0] < 3:
9+
import __builtin__ as builtins
10+
else:
11+
import builtins
712

813
# Version from file
914
__version__ = None
1015
version_file = os.path.join(os.path.dirname(__file__), 'tetgen', '_version.py')
1116
with io_open(version_file, mode='r') as fd:
1217
exec(fd.read())
1318

19+
# for: the cc1plus: warning: command line option '-Wstrict-prototypes'
20+
class build_ext(_build_ext):
21+
def finalize_options(self):
22+
_build_ext.finalize_options(self)
23+
# prevent numpy from thinking it is still in its setup process:
24+
try:
25+
del builtins.__NUMPY_SETUP__
26+
except AttributeError:
27+
pass
28+
import numpy
29+
self.include_dirs.append(numpy.get_include())
30+
31+
def build_extensions(self):
32+
try:
33+
self.compiler.compiler_so.remove("-Wstrict-prototypes")
34+
except (AttributeError, ValueError):
35+
pass
36+
_build_ext.build_extensions(self)
1437

1538
setup(
1639
name='tetgen',
1740
packages = ['tetgen'],
1841
version=__version__,
19-
description='Python interface to pytetgen',
20-
long_description=open('README.rst').read(),
42+
description='Python interface to pytetgen',
43+
long_description=open('README.rst').read(),
2144

2245
author='Alex Kaszynski',
2346
author_email='akascap@gmail.com',
24-
url = 'https://github.com/akaszynski/tetgen',
47+
url = 'https://github.com/akaszynski/tetgen',
2548

26-
license='MIT',
49+
license='MIT',
2750
classifiers=[
28-
'Development Status :: 4 - Beta',
2951
'Intended Audience :: Science/Research',
3052
'License :: OSI Approved :: MIT License',
3153
'Development Status :: 4 - Beta',
32-
'Intended Audience :: Science/Research',
3354
'Programming Language :: Python :: 2.7',
3455
'Programming Language :: Python :: 3.5',
3556
'Programming Language :: Python :: 3.6',
3657
],
3758

38-
3959
# Build cython modules
4060
cmdclass={'build_ext': build_ext},
4161
ext_modules = [Extension("tetgen._tetgen",
@@ -44,15 +64,14 @@
4464
'tetgen/cython/tetgen/predicates.cxx',
4565
'tetgen/cython/tetgen/tetgen_wrap.cxx'],
4666
language='c++',
47-
extra_compile_args=["-O3"],
67+
extra_compile_args=['-O3', '-w'],
4868
define_macros=[('TETLIBRARY', None)]),
4969
],
5070

5171
keywords='TetGen',
52-
53-
include_dirs=[numpy.get_include()],
54-
55-
# Might work with earlier versions
56-
install_requires=['numpy>1.9.3', 'pymeshfix']
72+
73+
install_requires=['numpy>1.9.3',
74+
'pymeshfix',
75+
'vtkInterface>=0.8.0']
5776

5877
)

tests/test_tetgen.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,30 @@ def functional_tet():
2727
subgrid = grid.ExtractSelectionCells(cell_ind)
2828

2929
# plot this
30-
subgrid.Plot(scalars=subgrid.quality, stitle='quality', colormap='bwr', flipscalars=True)
30+
subgrid.Plot(scalars=subgrid.quality, stitle='quality', colormap='bwr',
31+
flipscalars=True)
3132

3233
# advanced plotting
3334
plotter = vtki.PlotClass()
3435
plotter.SetBackground('w')
3536
plotter.AddMesh(subgrid, 'lightgrey', lighting=True)
36-
plotter.AddMesh(sphere, 'r', 'wireframe')
37+
plotter.AddMesh(grid, 'r', 'wireframe')
3738
plotter.AddLegend([[' Input Mesh ', 'r'],
3839
[' Tesselated Mesh ', 'black']])
3940
plotter.Plot()
4041

42+
plotter = vtki.PlotClass()
43+
plotter.SetBackground('w')
44+
plotter.AddMesh(grid, 'r', 'wireframe')
45+
plotter.Plot(autoclose=False)
46+
plotter.Plot(autoclose=False, interactive_update=True)
47+
for i in range(500):
48+
single_cell = grid.ExtractSelectionCells([i])
49+
plotter.AddMesh(single_cell)
50+
plotter.Update()
51+
plotter.Close()
4152

4253
if __name__ == '__main__':
43-
functional_tet()
54+
# functional_tet()
55+
test_tetrahedralize()
56+
print('PASS')

tetgen/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
from tetgen.tetgen import TetGen
1+
from tetgen import _tetgen
2+
from tetgen.pytetgen import TetGen

tetgen/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
""" tetgen version """
22

33
# major, minor, patch, -extra
4-
version_info = 0, 1, 0
4+
version_info = 0, 1, 1
55

66
# Nice string for the version
77
__version__ = '.'.join(map(str, version_info))

tetgen/cython/_qualcheck.pyx

Lines changed: 0 additions & 81 deletions
This file was deleted.

tetgen/cython/tetgen/_tetgen.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ cdef class PyBehavior:
130130
cdef tetgenbehavior c_behavior # hold a C++ instance which we're wrapping
131131
def __cinit__(self):
132132
self.c_behavior = tetgenbehavior()
133-
134-
133+
134+
135135
cdef class PyTetgenio:
136136
""" Python interface to tetgenio """
137137
cdef tetgenio_wrap c_tetio # hold a C++ instance which we're wrapping

0 commit comments

Comments
 (0)