-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
99 lines (80 loc) · 2.62 KB
/
setup.py
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
#!/usr/bin/env python
import os
import warnings
from setuptools import setup, find_packages
from textwrap import dedent
MAJOR = 0
MINOR = 3
MICRO = 5
VERSION = "{}.{}.{}".format(MAJOR, MINOR, MICRO)
DEV = False
# Correct versioning with git info if DEV
if DEV:
import subprocess
pipe = subprocess.Popen(
['git', "describe", "--always", "--match", "v[0-9]*"],
stdout=subprocess.PIPE)
so, err = pipe.communicate()
if pipe.returncode != 0:
# no git or something wrong with git (not in dir?)
warnings.warn("WARNING: Couldn't identify git revision, using generic version string")
VERSION += ".dev"
else:
git_rev = so.strip()
git_rev = git_rev.decode('ascii') # necessary for Python >= 3
VERSION += ".dev-{}".format(git_rev)
DESCRIPTION = "xarray interface for bpch files"
LONG_DESCRIPTION = """\
**xpbch** is a simple utility for reading the proprietary binary punch format
(bpch) outputs used in versions of GEOS-Chem earlier than v11-02. The utility
allows a user to load this data into an xarray/dask-powered workflow without
necessarily pre-processing the data using GAMAP or IDL.
"""
DISTNAME = "xbpch"
AUTHOR = "Daniel Rothenberg"
AUTHOR_EMAIL = "[email protected]"
URL = "https://github.com/darothen/xbpch"
LICENSE = "MIT"
DOWNLOAD_URL = ("https://github.com/darothen/xbpch/archive/v{}.tar.gz"
.format(VERSION))
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Intended Audience :: Science/Research',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering',
]
def _write_version_file():
fn = os.path.join(os.path.dirname(__file__), DISTNAME, 'version.py')
version_str = dedent("""
__version__ = '{}'
""")
# Write version file
with open(fn, 'w') as version_file:
version_file.write(version_str.format(VERSION))
# Write version and install
_write_version_file()
setup(
name = DISTNAME,
author = AUTHOR,
author_email = AUTHOR_EMAIL,
maintainer = AUTHOR,
maintainer_email = AUTHOR_EMAIL,
description = DESCRIPTION,
long_description = LONG_DESCRIPTION,
license = LICENSE,
url = URL,
version = VERSION,
download_url = DOWNLOAD_URL,
packages = find_packages(),
package_data = {},
scripts = [
'scripts/bpch_to_nc',
],
classifiers = CLASSIFIERS
)