-
Notifications
You must be signed in to change notification settings - Fork 8
/
setup.py
118 lines (106 loc) · 3.06 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
from distutils.extension import Extension
from distutils.version import StrictVersion, LooseVersion
from Cython.Distutils import build_ext
import warnings
import sys
import numpy
import platform
EX_COMP_ARGS = []
if 'mac' in platform.system().lower():
EX_COMP_ARGS += ['-stdlib=libc++', '-mmacosx-version-min=10.7']
# Dependency checking
dependencies = [['cython', '0.20.2'], ['numpy', '1.8'], ['astropy', '1.0']]
for (pkg, minversion) in dependencies:
try:
m = __import__(pkg)
if minversion is not None:
if StrictVersion(m.__version__) < StrictVersion(minversion):
if LooseVersion(m.__version__) < LooseVersion(minversion):
raise ValueError
warnings.warn(
'Version', m.__version__,
'of package', pkg,
'might not be sufficient'
)
except ImportError:
print('Package', pkg, 'not present.')
sys.exit(1)
except ValueError:
print('Package', pkg, 'has version', m.__version__)
print('Version', minversion, 'required.')
sys.exit(1)
GRID_EXT = Extension(
'cygrid.cygrid',
['cygrid/cygrid.pyx'],
extra_compile_args=['-fopenmp', '-O3', '-std=c++11'] + EX_COMP_ARGS,
extra_link_args=['-fopenmp'],
language='c++',
include_dirs=[
numpy.get_include(),
]
)
HELPER_EXT = Extension(
'cygrid.helpers',
['cygrid/helpers.pyx'],
extra_compile_args=['-fopenmp', '-O3', '-std=c++11'] + EX_COMP_ARGS,
extra_link_args=['-fopenmp'],
language='c++',
include_dirs=[
numpy.get_include(),
]
)
HPX_EXT = Extension(
'cygrid.healpix',
['cygrid/healpix.pyx'],
extra_compile_args=['-fopenmp', '-O3', '-std=c++11'] + EX_COMP_ARGS,
extra_link_args=['-fopenmp'],
language='c++',
include_dirs=[
numpy.get_include(),
]
)
HPHASH_EXT = Extension(
'cygrid.hphashtab',
['cygrid/hphashtab.pyx'],
extra_compile_args=['-fopenmp', '-O3', '-std=c++11'] + EX_COMP_ARGS,
extra_link_args=['-fopenmp'],
language='c++',
include_dirs=[
numpy.get_include(),
]
)
KERNEL_EXT = Extension(
'cygrid.kernels',
['cygrid/kernels.pyx'],
extra_compile_args=['-fopenmp', '-O3', '-std=c++11'] + EX_COMP_ARGS,
extra_link_args=['-fopenmp'],
language='c++',
include_dirs=[
numpy.get_include(),
]
)
setup(
name='cygrid',
version='0.9.4',
author='Benjamin Winkel, Lars Flöer, Daniel Lenz',
author_email='bwinkel@mpifr.de',
description=(
'Cygrid is a cython-powered convolution-based gridding module '
'for astronomy'
),
packages=['cygrid'],
cmdclass={'build_ext': build_ext},
ext_modules=[
KERNEL_EXT,
HELPER_EXT,
HPX_EXT,
HPHASH_EXT,
GRID_EXT,
],
url='https://github.com/bwinkel/cygrid/',
download_url='https://github.com/bwinkel/cygrid/tarball/0.9.4',
keywords=['astronomy', 'gridding', 'fits/wcs']
)