Completed
Push — develop ( 5c9deb...6e8450 )
by Kale
51s
created

Tox.finalize_options()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 4
rs 10
1
# -*- coding: utf-8 -*-
2
import os
3
from setuptools import setup, find_packages
4
from setuptools.command.test import test as TestCommand
5
import sys
6
7
here = os.path.abspath(os.path.dirname(__file__))
8
src_dir = os.path.join(here, "auxlib")
9
10
# When executing the setup.py, we need to be able to import ourselves, this
11
# means that we need to add the src/ directory to the sys.path.
12
sys.path.insert(0, src_dir)
13
14
about = {}
15
with open(os.path.join(src_dir, "__about__.py")) as f:
16
    exec(f.read(), about)
17
18
with open(os.path.join(src_dir, ".version")) as f:
19
    version = f.read().strip()
20
21
requirements = [
22
    "python-dateutil",
23
    "PyYAML",
24
]
25
26
27
class Tox(TestCommand):
28
    user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
29
30
    def initialize_options(self):
31
        TestCommand.initialize_options(self)
32
        self.tox_args = None
33
34
    def finalize_options(self):
35
        TestCommand.finalize_options(self)
36
        self.test_args = []
37
        self.test_suite = True
38
39
    def run_tests(self):
40
        # import here, cause outside the eggs aren't loaded
41
        import tox
42
        import shlex
43
        args = self.tox_args
44
        if args:
45
            args = shlex.split(self.tox_args)
46
        else:
47
            args = ''
48
        errno = tox.cmdline(args=args)
49
        sys.exit(errno)
50
51
52
if sys.version_info < (3, 4):
53
    requirements.append("enum34")
54
55
with open(os.path.join(here, "README.rst")) as f:
56
    long_description = f.read()
57
58
setup(
59
    name=about["__title__"],
60
    version=version,
61
62
    author=about['__author__'],
63
    author_email=about['__email__'],
64
    url=about['__homepage__'],
65
    license=about['__license__'],
66
67
    description=about['__summary__'],
68
    long_description=long_description,
69
70
    packages=find_packages(exclude=['tests', 'tests.*']),
71
    include_package_data=True,
72
    zip_safe=True,
73
74
    classifiers=[
75
        "Intended Audience :: Developers",
76
        "License :: OSI Approved :: Apache Software License",
77
        "License :: OSI Approved :: BSD License",
78
        "Natural Language :: English",
79
        "Operating System :: MacOS :: MacOS X",
80
        "Operating System :: POSIX",
81
        "Operating System :: POSIX :: BSD",
82
        "Operating System :: POSIX :: Linux",
83
        "Operating System :: Microsoft :: Windows",
84
        "Programming Language :: Python",
85
        "Programming Language :: Python :: 2",
86
        "Programming Language :: Python :: 2.7",
87
        "Programming Language :: Python :: 3",
88
        "Programming Language :: Python :: 3.4",
89
        "Programming Language :: Python :: 3.5",
90
        "Programming Language :: Python :: Implementation :: CPython",
91
        "Programming Language :: Python :: Implementation :: PyPy",
92
    ],
93
94
    install_requires=requirements,
95
    tests_require=["tox"],
96
    extras_require={
97
       'crypt': ["pycrypto"],
98
    },
99
    cmdclass={
100
        'test': Tox
101
    },
102
)
103