|
8 | 8 | from Cython.Build import cythonize |
9 | 9 |
|
10 | 10 |
|
11 | | -extensions = [Extension('stratify._vinterp', |
12 | | - ['stratify/_vinterp.pyx'], |
| 11 | +NAME = 'stratify' |
| 12 | +DIR = os.path.abspath(os.path.dirname(__file__)) |
| 13 | + |
| 14 | +extensions = [Extension('{}._vinterp'.format(NAME), |
| 15 | + [os.path.join(NAME, '_vinterp.pyx')], |
13 | 16 | include_dirs=[np.get_include()])] |
14 | 17 |
|
15 | | -setup( |
16 | | - name='stratify', |
17 | | - description='Vectorized interpolators that are especially useful for Nd vertical interpolation/stratification of atmospheric and oceanographic datasets', |
18 | | - version='0.3.0', |
| 18 | + |
| 19 | +def extract_version(): |
| 20 | + version = None |
| 21 | + fname = os.path.join(DIR, NAME, '__init__.py') |
| 22 | + with open(fname) as fd: |
| 23 | + for line in fd: |
| 24 | + if (line.startswith('__version__')): |
| 25 | + _, version = line.split('=') |
| 26 | + version = version.strip()[1:-1] # Remove quotations |
| 27 | + break |
| 28 | + return version |
| 29 | + |
| 30 | + |
| 31 | +setup_args = dict( |
| 32 | + name=NAME, |
| 33 | + description=('Vectorized interpolators that are especially useful for ' |
| 34 | + 'Nd vertical interpolation/stratification of atmospheric ' |
| 35 | + 'and oceanographic datasets'), |
| 36 | + version=extract_version(), |
19 | 37 | ext_modules=cythonize(extensions), |
20 | 38 | packages=find_packages(), |
21 | 39 | classifiers=[ |
22 | | - 'Development Status :: 3 - Alpha', |
23 | | - ('License :: OSI Approved :: ' |
24 | | - 'License :: OSI Approved :: BSD License'), |
25 | | - 'Operating System :: MacOS :: MacOS X', |
26 | | - 'Operating System :: POSIX', |
27 | | - 'Operating System :: POSIX :: AIX', |
28 | | - 'Operating System :: POSIX :: Linux', |
29 | | - 'Operating System :: Microsoft :: Windows', |
30 | | - 'Programming Language :: Python', |
31 | | - 'Programming Language :: Python :: 2', |
32 | | - 'Programming Language :: Python :: 2.7', |
33 | | - 'Programming Language :: Python :: 3', |
34 | | - 'Programming Language :: Python :: 3.4', |
35 | | - 'Programming Language :: Python :: 3.5', |
36 | | - 'Topic :: Scientific/Engineering', |
37 | | - 'Topic :: Scientific/Engineering :: GIS', |
| 40 | + 'Development Status :: 3 - Alpha', |
| 41 | + ('License :: OSI Approved :: ' |
| 42 | + 'License :: OSI Approved :: BSD License'), |
| 43 | + 'Operating System :: MacOS :: MacOS X', |
| 44 | + 'Operating System :: POSIX', |
| 45 | + 'Operating System :: POSIX :: AIX', |
| 46 | + 'Operating System :: POSIX :: Linux', |
| 47 | + 'Operating System :: Microsoft :: Windows', |
| 48 | + 'Programming Language :: Python', |
| 49 | + 'Programming Language :: Python :: 2', |
| 50 | + 'Programming Language :: Python :: 2.7', |
| 51 | + 'Programming Language :: Python :: 3', |
| 52 | + 'Programming Language :: Python :: 3.4', |
| 53 | + 'Programming Language :: Python :: 3.5', |
| 54 | + 'Topic :: Scientific/Engineering', |
| 55 | + 'Topic :: Scientific/Engineering :: GIS', |
38 | 56 | ], |
39 | | - extras_require={'test': ['nose'], |
40 | | - }, |
| 57 | + extras_require={'test': ['nose']}, |
| 58 | + test_suite='{}.tests'.format(NAME), |
41 | 59 | zip_safe=False, |
42 | 60 | ) |
| 61 | + |
| 62 | + |
| 63 | +if __name__ == '__main__': |
| 64 | + setup(**setup_args) |
0 commit comments