-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathsetup.py
More file actions
127 lines (109 loc) · 4.13 KB
/
setup.py
File metadata and controls
127 lines (109 loc) · 4.13 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
116
117
118
119
120
121
122
123
124
125
126
127
# -*- coding: utf-8 -*-
"""
Python tools for polarimetric radar retrievals.
To access, use the following in your analysis code:
from csu_radartools import (
csu_fhc, csu_kdp, csu_dsd, csu_liquid_ice_mass, csu_misc,
csu_blended_rain, fundamentals)
Works on Windows, but you'll need to install a C++ compiler (e.g. MSVC >=2015).
"""
import os
import ast
import setuptools
try:
import numpy
except ImportError:
raise RuntimeError("Cannot find NumPy. Please install it first "
"or use pip >= 10, which will do so automatically.")
# Set CSU_F2PY to True to use f2py instead of Cython for csu_kdp, etc
if ('CSURT_F2PY' in os.environ
and os.environ.get('CSURT_F2PY').lower() not in {'0', 'false', 'no'}):
USE_CYTHON = False
else:
USE_CYTHON = True
if USE_CYTHON:
from setuptools import setup, Extension # analysis:ignore
try:
import Cython # analysis:ignore
except ImportError:
raise RuntimeError("Cannot find Cython. Please install it first "
"or use pip >= 10, which will do so automatically.")
from Cython.Build import cythonize # analysis:ignore
from Cython.Compiler import Options # analysis:ignore
Options.language_level = '2'
else:
from numpy.distutils.core import setup, Extension # analysis:ignore
# Get current location
HERE = os.path.abspath(os.path.dirname(__file__))
# Pull the header into a variable
DOCLINES = __doc__.split('\n')
# Get packages
PACKAGES = setuptools.find_packages()
# Get package version
def get_version(module=None):
"""Get version string for package."""
if module is None:
module = setuptools.find_packages()[0]
with open(os.path.join(HERE, module, '_version.py'), 'r') as version_file:
data = version_file.read()
lines = data.split('\n')
for line in lines:
if line.startswith('VERSION_INFO'):
version_tuple = ast.literal_eval(line.split('=')[-1].strip())
version = '.'.join(map(str, version_tuple))
break
return version
if USE_CYTHON:
EXT = '.pyx'
else:
EXT = '.f'
INCLUDE_DIRS = [numpy.get_include(), '.']
# FIX: include_dirs needs to be passed to Extension, not setup()
EXTENSIONS = [Extension(PACKAGES[0] + '.calc_kdp_ray_fir',
[PACKAGES[0] + '/calc_kdp_ray_fir' + EXT],
include_dirs=INCLUDE_DIRS)] # <-- MOVED HERE
if USE_CYTHON:
EXTENSIONS = cythonize(EXTENSIONS, compiler_directives={'cpow': True})
# Run setup
# Run setup
setup(name='csu_radartools',
version=get_version(),
url='https://radarmet.atmos.colostate.edu',
download_url='https://github.com/CSU-Radarmet/CSU_RadarTools/releases',
author='Brenda Dolan, Brody Fuchs, Timothy Lang',
author_email='bdolan@colostate.edu',
description=DOCLINES[1],
long_description=__doc__,
long_description_content_type='text/plain', # Changed from markdown since __doc__ is plain
keywords='radar precipitation meteorology weather',
license='GPLv2', # Add explicit license
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX :: Linux',
'Operating System :: Unix',
'Programming Language :: Cython',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Scientific/Engineering :: Atmospheric Science',
],
packages=PACKAGES,
package_data={'csu_radartools': ['beta_function_parameters/*.csv']},
ext_modules=EXTENSIONS,
install_requires=[
'numpy>=1.18',
'scipy',
'matplotlib',
'pandas',
'cython',
'netCDF4',
],
python_requires='>=3.8',
)