-
Notifications
You must be signed in to change notification settings - Fork 9
/
setup.py
executable file
·87 lines (70 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
import os
import re
from setuptools import setup
from setuptools import Command
def _get_version():
"""Returns the PROTEUS software version from the
file `src/proteus/version.py`
Returns
-------
version : str
PROTEUS software version
"""
version_file = os.path.join('src','proteus','version.py')
with open(version_file, 'r') as f:
text = f.read()
# Get first match of the version number contained in the version file
# This regex should match a pattern like: VERSION = '3.2.5', but it
# allows for varying spaces, number of major/minor versions,
# and quotation mark styles.
p = re.search("VERSION[ ]*=[ ]*['\"]\d+([.]\d+)*['\"]", text)
# Check that the version file contains properly formatted text string
if p is None:
raise ValueError(
f'Version file {version_file} not properly formatted.'
" It should contain text matching e.g. VERSION = '2.3.4'")
# Extract just the numeric version number from the string
p = re.search("\d+([.]\d+)*", p.group(0))
return p.group(0)
__version__ = version = VERSION = _get_version()
print(f'proteus version {version}')
class CleanCommand(Command):
"""Custom clean command to tidy up the project root
after running `python setup.py install`."""
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
# Make sure to remove the .egg-info file
os.system('rm -vrf .scratch_dir ./build ./dist ./*.pyc ./*.tgz ./*.egg-info ./src/*.egg-info')
long_description = open('README.md').read()
package_data_dict = {}
package_data_dict['proteus'] = [
os.path.join('defaults', 'dswx_hls.yaml'),
os.path.join('schemas', 'dswx_hls.yaml')]
setup(
name='proteus',
version=version,
description='Compute Dynamic Surface Water Extent (DSWx)'
' from optical (HLS) data',
# Gather all packages located under `src`.
# (A package is any directory containing an __init__.py file.)
package_dir={'': 'src'},
packages=['proteus',
'proteus.extern'],
package_data=package_data_dict,
classifiers=['Programming Language :: Python',],
scripts=['bin/dswx_hls.py',
'bin/dswx_compare.py'],
install_requires=['argparse', 'numpy', 'yamale',
'osgeo', 'scipy', 'pytest', 'requests'],
url='https://github.com/opera-adt/PROTEUS',
license='Copyright by the California Institute of Technology.'
' ALL RIGHTS RESERVED.',
long_description=long_description,
cmdclass={
'clean': CleanCommand,
}
)