-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
90 lines (75 loc) · 2.6 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
# -*- coding:utf8 -*-
from __future__ import division, print_function, absolute_import
import os
import sys
import codecs
import re
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
here = os.path.abspath(os.path.dirname(__file__))
def read_file(path):
if os.path.exists(path):
with codecs.open(path, encoding='utf-8') as fp:
return fp.read()
return ''
def find_version(path):
try:
version_file = read_file(path)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return version_match.group(1)
except OSError:
raise RuntimeError("Unable to find version string.")
raise RuntimeError("Unable to find version string.")
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = [
'--pep8',
'--flakes',
'--cov=errcron',
]
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
def find_requires(requirements):
reqs = read_file(os.path.join(here, requirements))
return reqs.strip().split()
setup(
name='errcron',
version=find_version('errcron/__init__.py'),
url='https://github.com/attakei/errcron',
description='Crontab implementation for Errbot',
long_description=read_file(os.path.join(here, 'README.rst')),
author='attakei',
author_email='attakei@users.noreply.github.com',
license='GPLv3',
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Communications :: Chat',
],
keywords='errbot plugin crontab',
packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
install_requires=find_requires('requirements.txt'),
tests_require=find_requires('tests/requirements.txt'),
extras_require={'test': find_requires('tests/requirements.txt')},
cmdclass={
'test': PyTest,
},
entry_points={
'console_scripts': [
],
}
)