-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
setup.py
52 lines (39 loc) · 1.51 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
from distutils.core import setup
import glob
import os
import re
from pathlib import Path
import setuptools
import sys
import versioneer
if sys.version_info < (3, 7):
raise RuntimeError("Python version is {}. Requires 3.7 or greater."
"".format(sys.version_info))
def read(fname):
with open(Path(__file__).parent / fname) as f:
result = f.read()
return result
# Delimits a setup.py-compatible requirement name/version from the extras that
# only pip supports (environment info, CLI options, etc.).
# https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format
REQUIREMENT_DELIMITER = re.compile(r';|--')
def cleanup(line):
'''
Convert a pip requirements file line into an install_requires-style line.
'''
return REQUIREMENT_DELIMITER.split(line, 1)[0]
# Requirements not on PyPI or that use special pip features can't be installed
# through `install_requires`. They have to be installed manually or with
# `pip install -r requirements.txt`.
requirements = [cleanup(r) for r in read('requirements.txt').splitlines()
if not r.startswith('git+https://')]
setup(name='web_monitoring',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
packages=['web_monitoring',
'web_monitoring.cli'],
package_data={'web_monitoring': ['web_monitoring/tests/cassettes/*']},
scripts=glob.glob('scripts/*'),
install_requires=requirements,
long_description=read('README.md'),
)