generated from ARM-Development/arm-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
56 lines (46 loc) · 1.57 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
"""A setuptools-based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
import re
from codecs import open
from os import path, getenv
from setuptools import setup, find_packages
from subprocess import check_output, CalledProcessError
here = path.abspath(path.dirname(__file__))
# Get package name
name = getenv('BUILD_PACKAGE_NAME', 'ncrpy')
# Get package version
version = getenv('BUILD_PACKAGE_VERSION')
if version:
version = version.replace('-', '.', 1) # Change x.y-z to x.y.z
else:
command = 'git describe --tags'
try:
version = check_output(command.split()).decode('utf-8').strip()
version = re.search(r'.*v([0-9]+\.[0-9]+\.[0-9]+)', version).group(1)
except CalledProcessError:
version = '0.0.0'
# Write the version.py file
with open('ncr/version.py', 'w') as f:
f.write('# This file is autogenerated at build time.\n')
f.write('# It should not be committed to the repository.\n')
f.write('__version__ = "{}"'.format(version))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name=name,
version=version,
description='A tool to compare and/or summarize netCDF files',
long_description=long_description,
packages=find_packages(exclude=['test', 'web']),
install_requires=['netCDF4', 'act-atmos'],
entry_points={
'console_scripts': [
'ncreview = ncr.__main__:run',
'ncrplot = ncr.__main__:plot'
],
},
)