-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathsetup.py
executable file
·62 lines (55 loc) · 2.11 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
"""Build and install the SWOT Simulator for Ocean Science package."""
# from distutils.core import setup
from setuptools import setup, find_packages
import os
import sys
import shutil
import logging
logger = logging.getLogger()
handler = logging.StreamHandler()
handler.setLevel(logging.DEBUG)
logger.addHandler(handler)
logger.setLevel(logging.INFO)
# Check Python version
#if not 3 == sys.version_info[0]:
# logger.error('This package is only available for Python 3.x')
# sys.exit(1)
__package_name__ = 'swotsimulator'
project_dir = os.path.dirname(__file__)
#git_exe = shutil.which('git')
#git_dir = os.path.join(project_dir, '.git')
#has_git = (git_exe is not None and os.path.isdir(git_dir))
# version_file = os.path.join(project_dir, 'VERSION.txt')
readme_file = os.path.join(project_dir, 'README')
package_dir = os.path.join(project_dir, __package_name__)
init_file = os.path.join(package_dir, '__init__.py')
# - Read in the package version and author fields from the Python
# main __init__.py file:
metadata = {}
with open(init_file, 'rt') as f:
exec(f.read(), metadata)
requirements = []
with open('requirements.txt', 'r') as f:
lines = [x.strip() for x in f if 0 < len(x.strip())]
requirements = [x for x in lines if x[0].isalpha()]
with open(readme_file, 'rt') as f:
long_description = f.read()
optional_dependencies = {'plot': ['matplotlib', ], 'carto': ['matplotlib',
'cartopy'], 'pyresample': ['pyresample', ]}
cmds = ['swotsimulator = {}.cli:run_swot_script'.format(__package_name__),
'nadirsimulator = {}.cli:run_nadir_script'.format(__package_name__),]
setup(name='swotsimulator',
version=metadata['__version__'],
description=metadata['__description__'],
author=metadata['__author__'],
author_email=metadata['__author_email__'],
url=metadata['__url__'],
license='COPYING',
keywords=metadata['__keywords__'],
long_description=long_description,
packages=find_packages(),
install_requires=requirements,
setup_require=(),
entry_points={'console_scripts': cmds},
extras_require=optional_dependencies,
)