forked from ansys/pymapdl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
155 lines (128 loc) · 4.72 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
"""
Installation file for pyansys
"""
import os
import sys
from io import open as io_open
import pip
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as _build_ext
class build_ext(_build_ext):
""" build class that includes numpy directory """
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())
def compilerName():
""" Check compiler and assign compile arguments accordingly """
import re
import distutils.ccompiler
comp = distutils.ccompiler.get_default_compiler()
getnext = False
for a in sys.argv[2:]:
if getnext:
comp = a
getnext = False
continue
# separated by space
if a == '--compiler' or re.search('^-[a-z]*c$', a):
getnext = True
continue
# without space
m = re.search('^--compiler=(.+)', a)
if m is None:
m = re.search('^-[a-z]*c(.+)', a)
if m:
comp = m.group(1)
return comp
# Assign arguments based on compiler
compiler = compilerName()
if compiler == 'unix':
cmp_arg = ['-O3', '-w']
else:
cmp_arg = ['/Ox', '-w']
# Get version from version info
__version__ = None
version_file = os.path.join(
os.path.dirname(__file__),
'pyansys',
'_version.py')
with io_open(version_file, mode='r') as fd:
# execute file from raw string
exec(fd.read())
# Actual setup
setup(
name='pyansys',
packages=['pyansys', 'pyansys.examples'],
# Version
version=__version__,
description='Pythonic interface to ANSYS binary files',
long_description=open('README.rst').read(),
# Author details
author='Alex Kaszynski',
author_email='[email protected]',
license='MIT',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering :: Information Analysis',
'License :: OSI Approved :: MIT License',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: MacOS',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
# Website
url='https://github.com/akaszynski/pyansys',
# Build cython modules
cmdclass={'build_ext': build_ext},
ext_modules=[Extension("pyansys._parsefull",
['pyansys/cython/_parsefull.pyx',
'pyansys/cython/parsefull.c'],
extra_compile_args=cmp_arg,
language='c'),
Extension("pyansys._parser",
["pyansys/cython/_parser.pyx"],
extra_compile_args=cmp_arg,
language='c'),
Extension('pyansys._reader',
['pyansys/cython/_reader.pyx',
'pyansys/cython/reader.c'],
extra_compile_args=cmp_arg,
language='c',),
Extension("pyansys._relaxmidside",
["pyansys/cython/_relaxmidside.pyx"],
extra_compile_args=cmp_arg,
language='c'),
Extension("pyansys._cellqual",
["pyansys/_cellqual.pyx"],
extra_compile_args=cmp_arg,
language='c'),
Extension("pyansys._cellqualfloat",
["pyansys/cython/_cellqualfloat.pyx"],
extra_compile_args=cmp_arg,
language='c'),
Extension("pyansys._binary_reader",
["pyansys/cython/_binary_reader.pyx"],
extra_compile_args=cmp_arg,
language='c'),
],
keywords='vtk ANSYS cdb full rst',
package_data={'pyansys.examples': ['TetBeam.cdb',
'HexBeam.cdb',
'file.rst',
'file.full',
'sector.rst',
'sector.cdb']},
install_requires=['numpy>=1.14.0',
'vtki>=0.16.3',
'ansys_corba',
'appdirs',
'psutil>=5.0.0',
'pexpect']
)