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