1"""setup.py: setuptools control."""
2
3import io
4import os
5import sys
6
7from setuptools import find_packages
8from setuptools import setup
9
10DESCRIPTION = """
11For the full README and other project information, please see the
12`Vanguard project page on github <https://github.com/mikeperry-tor/vanguards>`_.
13"""
14
15# Read version and other info from package's __init.py file
16module_info = {}
17init_path = os.path.join(os.path.dirname(__file__), "src", 'vanguards',
18                         '__init__.py')
19with open(init_path) as init_file:
20    exec(init_file.read(), module_info)
21
22
23import sys
24
25from setuptools.command.test import test as TestCommand
26
27
28class PyTest(TestCommand):
29    user_options = [("pytest-args=", "a", "Arguments to pass to pytest")]
30
31    def initialize_options(self):
32        TestCommand.initialize_options(self)
33        self.pytest_args = "tests"
34
35    def run_tests(self):
36        import shlex
37
38        # import here, cause outside the eggs aren't loaded
39        import pytest
40
41        errno = pytest.main(shlex.split(self.pytest_args))
42        sys.exit(errno)
43
44def read(*names, **kwargs):
45    return io.open(
46        os.path.join(os.path.dirname(__file__), *names),
47        encoding=kwargs.get("encoding", "utf8")
48    ).read()
49
50setup(
51    name="vanguards",
52    packages=find_packages('src'),
53    package_dir={'': 'src'},
54    entry_points={
55        "console_scripts": [
56            'vanguards = vanguards.main:main',
57        ]},
58    description="Vanguards help guard you from getting vanned...",
59    long_description=DESCRIPTION,
60    include_package_data=True,
61    version=module_info.get('__version__'),
62    author=module_info.get('__author__'),
63    author_email=module_info.get('__contact__'),
64    url=module_info.get('__url__'),
65    license=module_info.get('__license__'),
66    tests_require=['pytest'],
67    cmdclass={"test": PyTest},
68    keywords='tor',
69    install_requires=[
70        'setuptools',
71        'ipaddress>=1.0.17 ; python_version<"3"',
72        'stem>=1.7.0',
73        ],
74    classifiers=[
75        'Development Status :: 4 - Beta',
76        'License :: OSI Approved :: MIT License',
77        'Programming Language :: Python :: 2',
78        'Programming Language :: Python :: 2.7',
79        'Programming Language :: Python :: 3',
80        'Programming Language :: Python :: 3.5',
81    ]
82)
83