1
|
|
|
from codecs import open |
2
|
|
|
from os import path |
3
|
|
|
import re |
4
|
|
|
# Always prefer setuptools over distutils |
5
|
|
|
from setuptools import find_packages, setup |
6
|
|
|
|
7
|
|
|
name = "eppaurora" |
8
|
|
|
meta_path = path.join("src", name, "__init__.py") |
9
|
|
|
here = path.abspath(path.dirname(__file__)) |
10
|
|
|
|
11
|
|
|
extras_require = { |
12
|
|
|
"models": ["h5netcdf", "xarray"], |
13
|
|
|
"tests": ["pytest"], |
14
|
|
|
} |
15
|
|
|
extras_require["all"] = sorted( |
16
|
|
|
{v for req in extras_require.values() for v in req} |
17
|
|
|
) |
18
|
|
|
|
19
|
|
|
|
20
|
|
|
# Approach taken from |
21
|
|
|
# https://packaging.python.org/guides/single-sourcing-package-version/ |
22
|
|
|
# and the `attrs` package https://www.attrs.org/ |
23
|
|
|
# https://github.com/python-attrs/attrs |
24
|
|
|
def read(*parts): |
25
|
|
|
""" |
26
|
|
|
Builds an absolute path from *parts* and and return the contents of the |
27
|
|
|
resulting file. Assumes UTF-8 encoding. |
28
|
|
|
""" |
29
|
|
|
with open(path.join(here, *parts), "rb", "utf-8") as f: |
30
|
|
|
return f.read() |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
def find_meta(meta, *path): |
34
|
|
|
""" |
35
|
|
|
Extract __*meta*__ from *path* (can have multiple components) |
36
|
|
|
""" |
37
|
|
|
meta_file = read(*path) |
38
|
|
|
meta_match = re.search( |
39
|
|
|
r"^__{meta}__ = ['\"]([^'\"]*)['\"]".format(meta=meta), meta_file, re.M, |
40
|
|
|
) |
41
|
|
|
if not meta_match: |
42
|
|
|
raise RuntimeError("__{meta}__ string not found.".format(meta=meta)) |
43
|
|
|
return meta_match.group(1) |
44
|
|
|
|
45
|
|
|
|
46
|
|
|
# Get the long description from the README file |
47
|
|
|
long_description = read("README.md") |
48
|
|
|
version = find_meta("version", meta_path) |
49
|
|
|
|
50
|
|
|
if __name__ == "__main__": |
51
|
|
|
setup( |
52
|
|
|
name=name, |
53
|
|
|
version=version, |
54
|
|
|
description="Atomspheric ionization from auroral particle precipitation", |
55
|
|
|
long_description=long_description, |
56
|
|
|
long_description_content_type="text/markdown", |
57
|
|
|
url="https://github.com/st-bender/pyeppaurora", |
58
|
|
|
author="Stefan Bender", |
59
|
|
|
author_email="[email protected]", |
60
|
|
|
license="GPLv2", |
61
|
|
|
classifiers=[ |
62
|
|
|
"Development Status :: 4 - Beta", |
63
|
|
|
"Intended Audience :: Science/Research", |
64
|
|
|
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)", |
65
|
|
|
"Programming Language :: Python", |
66
|
|
|
"Programming Language :: Python :: 2", |
67
|
|
|
"Programming Language :: Python :: 3", |
68
|
|
|
'Topic :: Scientific/Engineering :: Physics', |
69
|
|
|
'Topic :: Utilities', |
70
|
|
|
], |
71
|
|
|
packages=find_packages("src"), |
72
|
|
|
package_dir={"": "src"}, |
73
|
|
|
package_data={ |
74
|
|
|
name + ".models": [ |
75
|
|
|
"models/data/SSUSI_IRgrid_coeffs_f17f18.nc", |
76
|
|
|
"models/data/Zhang2008.txt", |
77
|
|
|
], |
78
|
|
|
}, |
79
|
|
|
include_package_data=True, |
80
|
|
|
install_requires=[ |
81
|
|
|
"numpy>=1.14.0", |
82
|
|
|
"scipy>=0.9", # LinearNDInterpolator |
83
|
|
|
], |
84
|
|
|
extras_require=extras_require, |
85
|
|
|
scripts=[], |
86
|
|
|
entry_points={}, |
87
|
|
|
zip_safe=False, |
88
|
|
|
) |
89
|
|
|
|