forked from chrislupp/MTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
91 lines (73 loc) · 2.53 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
#===============================================================================
#
# Modal Tool Kit (MTK)
#
# Copyright 2017-2020 Christopher A. Lupp
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#===============================================================================
import os
from subprocess import check_output
import sys
import eigency
import numpy
from setuptools import setup, find_packages
from setuptools.extension import Extension
from Cython.Build import cythonize
# Convert from local to absolute directories
#-------------------------------------------
def GlobalDirectory(files):
root_dir = os.path.abspath(os.path.dirname(__file__))
new = []
for f in files:
new.append(os.path.join(root_dir, f))
return new
def ReadConfigFile(fname):
"""Reads a config file and sets the include directories
"""
f = open(fname, 'r')
list = []
for line in f:
if line[0] == "#":
# treat as a commented line
pass
elif len(line.rstrip()) == 0:
# skip empty lines
pass
else:
list += [line.rstrip(),]
return list
inc_dirs = []
# find the eigen root directory and add it to the include path
inc_dirs = ReadConfigFile("Includes.config")
# Relative paths for the include/library directories
rel_inc_dirs = ['MTK/include/']
# Convert from relative to absolute directories
inc_dirs.extend(GlobalDirectory(rel_inc_dirs))
exts = [Extension('MTK.MTK', sources=['MTK/MTK.pyx'],
include_dirs=inc_dirs + eigency.get_includes())
]
for e in exts:
e.cython_directives = {"embedsignature": True, "binding":True}
setup(name='modaltoolkit',
version='3.0.0',
description='Modal Tool Kit',
author='Christopher A. Lupp',
author_email='[email protected]',
include_package_data=True,
packages = find_packages(),
package_data = {"MTK": ['*.pxd','include/*']},
ext_modules=cythonize(exts),
install_requires = ['numpy','h5py','eigency','sphinx', 'matplotlib']
)