-
Notifications
You must be signed in to change notification settings - Fork 32
/
setup.py
84 lines (69 loc) · 2.39 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
#!/usr/bin/env python
# coding=utf-8
import os
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
REQUIREMENTS = []
if sys.platform.startswith('darwin'):
REQUIREMENTS.append('pyobjc-core >= 2.5')
TEST_REQUIREMENTS = [
'pytest',
'pytest-cov',
]
if sys.version_info < (3,):
TEST_REQUIREMENTS.extend([
'mock',
'unittest2'
])
with open(os.path.join(os.path.dirname(__file__), 'power', 'version.py')) as f:
VERSION = None
code = compile(f.read(), 'version.py', 'exec')
exec(code)
assert VERSION
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass to pytest")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = ''
def run_tests(self):
import shlex
#import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(shlex.split(self.pytest_args))
sys.exit(errno)
setup(
name="power",
version=VERSION,
description="Cross-platform system power status information.",
long_description="Library that allows you get current power source type (AC, Battery or UPS), "
"warning level (none, <22%, <10min) and remaining minutes. "
"You can also observe changes of power source and remaining time.",
author="Ilya Kulakov",
author_email="[email protected]",
url="https://github.com/Kentzo/Power",
platforms=["Mac OS X 10.6+", "Windows XP+", "Linux 2.6+", "FreeBSD"],
packages=['power'],
license="MIT License",
classifiers=[
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: System :: Monitoring',
'Topic :: System :: Power (UPS)',
],
install_requires=REQUIREMENTS,
tests_require=TEST_REQUIREMENTS,
extras_require={
'tests': TEST_REQUIREMENTS
},
cmdclass={'test': PyTest}
)