-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.py
More file actions
115 lines (98 loc) · 3.63 KB
/
setup.py
File metadata and controls
115 lines (98 loc) · 3.63 KB
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 4 13:26:24 2017
@author: Dan
"""
import os, sys
from setuptools import setup
from distutils.extension import Extension
import numpy as np
VERSION = '0.65'
#==============================================================================
if 'develop' in sys.argv:
USE_CYTHON = True
ANNOTATE = True
PROFILE = True
else:
USE_CYTHON = False #Use Cython to generate c++ source files?
ANNOTATE = False #Annotate Cython files?
PROFILE = False #Profile Cython code?
#==============================================================================
def no_cythonize(extensions, **_ignore):
'''
Adapt cython extensions to use ready made c/c++ source files.
'''
for extension in extensions:
sources = []
for sfile in extension.sources:
path, ext = os.path.splitext(sfile)
if ext in ('.pyx', '.py'):
if extension.language == 'c++':
ext = '.cpp'
else:
ext = '.c'
sfile = path + ext
sources.append(sfile)
extension.sources[:] = sources
return extensions
if USE_CYTHON:
try:
from Cython.Build import cythonize
ext_func = cythonize
except ImportError:
sys.stderr.write('Cython was not found!\n')
sys.exit(-1)
else:
ext_func = no_cythonize
#==============================================================================
extensions = [
Extension('deepscan.cython.cy_deblend',
['deepscan/cython/cy_deblend.pyx'],
include_dirs=[np.get_include()],
extra_compile_args=['-std=c++11'],
extra_link_args=[],
language='c++'),
Extension('deepscan.cython.cy_skymap',
['deepscan/cython/cy_skymap.pyx'],
include_dirs=[np.get_include()],
extra_compile_args=['-std=c++11'],
extra_link_args=[],
language='c++'),
Extension('deepscan.cython.cy_makecat',
['deepscan/cython/cy_makecat.pyx'],
include_dirs=[np.get_include()],
extra_compile_args=['-std=c++11'],
extra_link_args=[],
language='c++'),
Extension('deepscan.cython.cy_dbscan',
['deepscan/cython/cy_dbscan.pyx'],
include_dirs=[np.get_include()],
extra_compile_args=['-std=c++11'],
extra_link_args=[],
language='c++')
]
#==============================================================================
setup(name='deepscan',
version=VERSION,
description='DeepScan is a source extraction tool designed to identify \
extended low surface brightness features in large astronomical datasets.',
url='https://github.com/danjampro/DeepScan',
author='danjampro',
author_email='danjampro@sky.com',
license='GPL v3.0',
packages=['deepscan'],
package_data={'deepscan/cython':['*.pxd']},
install_requires=[
'numpy',
'scipy',
'matplotlib',
'pandas',
'astropy',
'shapely'],
zip_safe=False,
ext_modules = ext_func(extensions, annotate=ANNOTATE,
compiler_directives={'profile':PROFILE})
)
#==============================================================================
#==============================================================================