forked from Gandi/gandi.cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
96 lines (80 loc) · 2.98 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
91
92
93
94
95
96
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
try:
from multiprocessing import cpu_count
self.pytest_args = ['-n', str(cpu_count()), '--boxed']
self.pytest_args = []
except (ImportError, NotImplementedError):
self.pytest_args = ['-n', '1', '--boxed']
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)
with open(os.path.join(here, 'gandi', 'cli', '__init__.py')) as v_file:
version = re.compile(r".*__version__ = '(.*?)'",
re.S).match(v_file.read()).group(1)
requires = ['setuptools', 'pyyaml', 'click>=7.0', 'requests', 'IPy']
tests_require = ['pytest', 'pytest-cov', 'tox']
if sys.version_info < (3, 0):
tests_require += ['mock']
else:
if sys.version_info < (3, 4):
raise RuntimeError(
"Python 3 earlier than 3.4 is not supported"
" (sys.version: {})".format(sys.version))
extras_require = {
'test': tests_require,
}
setup(name='gandi.cli',
namespace_packages=['gandi'],
version=version,
description='Gandi command line interface',
long_description=README + '\n\n' + CHANGES,
long_description_content_type='text/markdown',
author='Gandi',
author_email='[email protected]',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Terminals',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
],
url='https://github.com/Gandi/gandi.cli',
packages=find_packages(),
cmdclass={'test': PyTest},
include_package_data=True,
zip_safe=False,
install_requires=requires,
tests_require=tests_require,
extras_require=extras_require,
entry_points={
'console_scripts': [
'gandi = gandi.cli.__main__:main',
],
},
)