-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
48 lines (39 loc) · 1.27 KB
/
Copy pathsetup.py
File metadata and controls
48 lines (39 loc) · 1.27 KB
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
import re
import os
import sys
from setuptools import setup
from setuptools.command.test import test
class pytest_(test):
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
def initialize_options(self):
test.initialize_options(self)
self.pytest_args = []
def finalize_options(self):
test.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
def dunder(name):
path_components = os.path.dirname(__file__), 'expr', '__init__.py'
with open(os.path.join(*path_components)) as initpy:
return (re.compile(r".*{0} = '(.*?)'".format(name), re.S)
.match(initpy.read()).group(1))
setup_kwargs = {
'author': 'bmcorser',
'author_email': 'bmcorser@gmail.com',
'url': 'https://github.com/bmcorser/expr',
'name': 'expr',
'packages': ['expr'],
'install_requires': ['pydot'],
'version': dunder('__version__'),
'tests_require': ['pytest'],
'description': 'Draw little expression graphs; made to be hacked on.',
'long_description': open('README.rst', 'r').read(),
'cmdclass': {
'test': pytest_,
},
}
setup(**setup_kwargs)