-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
102 lines (84 loc) · 3.07 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
#
# This file is part of pyHoloGen.
# Copyright (C) 2015-2018 Svetlin Tassev
# Braintree High School
# Harvard-Smithsonian Center for Astrophysics
#
# pyHoloGen is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from distutils.extension import Extension
from distutils.util import get_platform
from distutils.ccompiler import get_default_compiler
import os
try:
from Cython.Distutils import build_ext as build_ext
sources = [os.path.join(os.getcwd(), 'holo_sum.pyx')
]
except ImportError as e:
sources = [os.path.join(os.getcwd(), 'holo_sum.c')
]
for i in sources:
if not os.path.exists(i):
print i
print os.path.exists(i)
raise ImportError(str(e) + '. ' +
'Cython is required to build the initial .c file.')
# We can't cythonize, but that's ok as it's been done already.
from distutils.command.build_ext import build_ext
include_dirs = []
library_dirs = []
package_data = {}
libraries = []
ext_modules = [Extension(
"holo_sum",
[sources[0]],
extra_compile_args=['-fopenmp','-O3','-shared' ,'-pthread' ,'-fPIC' ,'-fwrapv','-fno-strict-aliasing'],
extra_link_args=['-fopenmp','-O3','-shared' ,'-pthread' ,'-fPIC' ,'-fwrapv','-fno-strict-aliasing'],
libraries=libraries,
include_dirs=include_dirs
)
]
long_description="""Hologram maker
"""
setup_args = {
'name': 'pyHoloGen',
'version': 1.0,
'author': 'Svetlin Tassev',
'author_email': 'stassev@alum.mit.edu',
'description': 'A Python/Cython code for calculating computer-generated binary holograms.',
'url': '',
'long_description': long_description,
'classifiers': [
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Cython',
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Intended Audience :: Education',
'Topic :: Education',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Physics'
],
'packages':['pyHoloGen'],
'ext_modules': ext_modules,
'include_dirs': include_dirs,
'cmdclass' : {'build_ext': build_ext},
}
if __name__ == '__main__':
setup(**setup_args)