-
Notifications
You must be signed in to change notification settings - Fork 64
/
setup.py
107 lines (90 loc) · 3.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
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
100
101
102
103
104
105
106
107
import os
import re
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def run_tests(self):
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)
rootpath = os.path.abspath(os.path.dirname(__file__))
with open('README.rst') as f:
# use README for long description but don't include the link to travis-ci;
# it seems a bit out of place on pypi since it applies to the development
# version
long_description = ''.join([
line for line in f.readlines()
])
# this sets __version__
def version():
"""Get the version number."""
with open(os.path.join(rootpath, "VERSION.txt")) as v:
_version = v.read()
return _version.strip()
__version__ = version()
def parse_requirement(requirement, excludes):
lib = requirement.strip().split('#')[0] # strip new lines and comments
if lib:
lib_name = re.split(r'[[<>=! ]+', lib)[0]
if lib_name in excludes:
return ''
return lib.strip()
return ''
def load_requirements(excludes=None):
if excludes is None:
excludes = []
requirements = []
with open('requirements.txt') as requirements_file:
line = requirements_file.readline()
while line:
line = line.strip()
while line.endswith('\\'):
line += requirements_file.readline().strip()
line = ' '.join(line.split('\\'))
requirement = parse_requirement(line, excludes)
if requirement:
requirements.append(requirement)
line = requirements_file.readline()
return requirements
excludes = ['pytest']
required = load_requirements(excludes)
setup(
name='ulmo',
version=__version__,
license='BSD',
author='Dharhas Pothina',
author_email='[email protected]',
description='clean, simple and fast access to public hydrology and climatology data',
long_description=long_description,
url='https://github.com/ulmo-dev/ulmo/',
keywords='his ulmo water waterml cuahsi wateroneflow usgs ned',
packages=find_packages(),
platforms='any',
install_requires=required,
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Software Development :: Libraries :: Python Modules',
],
tests_require=[
'mock',
'freezegun',
'pytest',
'httpretty',
'html5lib',
],
cmdclass={'test': PyTest},
)