-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
62 lines (51 loc) · 1.55 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
# -*- coding: utf-8 -*-
import sys
from setuptools import (
find_packages,
setup,
)
from setuptools.command.test import test as TestCommand
def get_install_requires(requirements_file='requirements.txt'):
"""
parse requirements.txt, ignore links, exclude comments
"""
requirements = []
for line in open(requirements_file).readlines():
# skip to next iteration if comment or empty line
if line.startswith('#') or line == '' or line.startswith('http') \
or line.startswith('git'):
continue
# add line to requirements
requirements.append(line)
return requirements
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', '-q')]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = []
def finalize_options(self):
TestCommand.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)
setup(name='can2mqtt',
version='1',
description='Home Automation CAN <-> MQTT bridge',
author='pawel.sadowski',
author_email='[email protected]',
packages=[
'can2mqtt',
],
package_dir={},
scripts=[
'can2mqtt.py',
],
package_data={
},
install_requires=get_install_requires('requirements.txt'),
tests_require=get_install_requires('requirements-dev.txt'),
cmdclass={'test': PyTest},
)