import sys
import setuptools
from setuptools.command.test import test as TestCommand


def read_file(filename):
    with open(filename, "r", encoding='utf8') as f:
        return f.read()


class PyTest(TestCommand):
    """PyTest"""

    def finalize_options(self):
        """finalize_options"""
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        """run_tests"""
        import pytest

        errcode = pytest.main(self.test_args)
        sys.exit(errcode)


setuptools.setup(
    name="calm.dsl",
    version="0.9.0-alpha",
    author="Nutanix",
    author_email="nucalm@nutanix.com",
    description="Calm DSL for blueprints",
    long_description=read_file("README.md"),
    long_description_content_type="text/markdown",
    url="https://github.com/nutanix/calm-dsl",
    packages=setuptools.find_namespace_packages(include=["calm.*"]),
    namespace_packages=["calm"],
    install_requires=read_file("requirements.txt"),
    tests_require=read_file("dev-requirements.txt"),
    cmdclass={"test": PyTest},
    zip_safe=False,
    include_package_data=True,
    entry_points={"console_scripts": ["calm=calm.dsl.cli:main"]},
    classifiers=[
        "Development Status :: 3 - Alpha",
        "Environment :: Console",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: Apache Software License",
        "Natural Language :: English",
        "Operating System :: OS Independent",
        "Programming Language :: Python :: 3.7",
    ],
)

[((16, 8, 16, 42), 'setuptools.command.test.test.finalize_options', 'TestCommand.finalize_options', ({(16, 37, 16, 41): 'self'}, {}), '(self)', True, 'from setuptools.command.test import test as TestCommand\n'), ((24, 18, 24, 45), 'pytest.main', 'pytest.main', ({(24, 30, 24, 44): 'self.test_args'}, {}), '(self.test_args)', False, 'import pytest\n'), ((25, 8, 25, 25), 'sys.exit', 'sys.exit', ({(25, 17, 25, 24): 'errcode'}, {}), '(errcode)', False, 'import sys\n'), ((37, 13, 37, 67), 'setuptools.find_namespace_packages', 'setuptools.find_namespace_packages', (), '', False, 'import setuptools\n')]