Skip to content

Commit

Permalink
cleaned up for manylinux
Browse files Browse the repository at this point in the history
  • Loading branch information
akaszynski committed Jun 20, 2018
1 parent 89160b5 commit 20a8cd9
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 676 deletions.
47 changes: 33 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,61 @@
import os
import sys
import numpy
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from setuptools.command.build_ext import build_ext as _build_ext
from io import open as io_open

if sys.version_info[0] < 3:
import __builtin__ as builtins
else:
import builtins

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

# for: the cc1plus: warning: command line option '-Wstrict-prototypes'
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:
try:
del builtins.__NUMPY_SETUP__
except AttributeError:
pass
import numpy
self.include_dirs.append(numpy.get_include())

def build_extensions(self):
try:
self.compiler.compiler_so.remove("-Wstrict-prototypes")
except (AttributeError, ValueError):
pass
_build_ext.build_extensions(self)

setup(
name='tetgen',
packages = ['tetgen'],
version=__version__,
description='Python interface to pytetgen',
long_description=open('README.rst').read(),
description='Python interface to pytetgen',
long_description=open('README.rst').read(),

author='Alex Kaszynski',
author_email='[email protected]',
url = 'https://github.com/akaszynski/tetgen',
url = 'https://github.com/akaszynski/tetgen',

license='MIT',
license='MIT',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],


# Build cython modules
cmdclass={'build_ext': build_ext},
ext_modules = [Extension("tetgen._tetgen",
Expand All @@ -44,15 +64,14 @@
'tetgen/cython/tetgen/predicates.cxx',
'tetgen/cython/tetgen/tetgen_wrap.cxx'],
language='c++',
extra_compile_args=["-O3"],
extra_compile_args=['-O3', '-w'],
define_macros=[('TETLIBRARY', None)]),
],

keywords='TetGen',

include_dirs=[numpy.get_include()],

# Might work with earlier versions
install_requires=['numpy>1.9.3', 'pymeshfix']

install_requires=['numpy>1.9.3',
'pymeshfix',
'vtkInterface>=0.8.0']

)
19 changes: 16 additions & 3 deletions tests/test_tetgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,30 @@ def functional_tet():
subgrid = grid.ExtractSelectionCells(cell_ind)

# plot this
subgrid.Plot(scalars=subgrid.quality, stitle='quality', colormap='bwr', flipscalars=True)
subgrid.Plot(scalars=subgrid.quality, stitle='quality', colormap='bwr',
flipscalars=True)

# advanced plotting
plotter = vtki.PlotClass()
plotter.SetBackground('w')
plotter.AddMesh(subgrid, 'lightgrey', lighting=True)
plotter.AddMesh(sphere, 'r', 'wireframe')
plotter.AddMesh(grid, 'r', 'wireframe')
plotter.AddLegend([[' Input Mesh ', 'r'],
[' Tesselated Mesh ', 'black']])
plotter.Plot()

plotter = vtki.PlotClass()
plotter.SetBackground('w')
plotter.AddMesh(grid, 'r', 'wireframe')
plotter.Plot(autoclose=False)
plotter.Plot(autoclose=False, interactive_update=True)
for i in range(500):
single_cell = grid.ExtractSelectionCells([i])
plotter.AddMesh(single_cell)
plotter.Update()
plotter.Close()

if __name__ == '__main__':
functional_tet()
# functional_tet()
test_tetrahedralize()
print('PASS')
3 changes: 2 additions & 1 deletion tetgen/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from tetgen.tetgen import TetGen
from tetgen import _tetgen
from tetgen.pytetgen import TetGen
2 changes: 1 addition & 1 deletion tetgen/_version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
""" tetgen version """

# major, minor, patch, -extra
version_info = 0, 1, 0
version_info = 0, 1, 1

# Nice string for the version
__version__ = '.'.join(map(str, version_info))
81 changes: 0 additions & 81 deletions tetgen/cython/_qualcheck.pyx

This file was deleted.

4 changes: 2 additions & 2 deletions tetgen/cython/tetgen/_tetgen.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ cdef class PyBehavior:
cdef tetgenbehavior c_behavior # hold a C++ instance which we're wrapping
def __cinit__(self):
self.c_behavior = tetgenbehavior()


cdef class PyTetgenio:
""" Python interface to tetgenio """
cdef tetgenio_wrap c_tetio # hold a C++ instance which we're wrapping
Expand Down
Loading

0 comments on commit 20a8cd9

Please sign in to comment.