import re

import setuptools, os


def open_local(paths, mode="r", encoding="utf8"):
    path = os.path.join(os.path.abspath(os.path.dirname(__file__)), *paths)
    return open(path, mode=mode, encoding=encoding)


with open_local(["s3recon", "__init__.py"]) as f:
    version = re.search(r"__version__ = [\"'](\d+\.\d+\.\d+)[\"']", f.read()).group(1)

with open_local(["README.md"]) as f:
    long_description = f.read()

install_requires = ["mergedeep>=1.0"]

setuptools.setup(
    name="s3recon",
    version=version,
    author="Travis Clarke",
    author_email="travis.m.clarke@gmail.com",
    description="Amazon S3 bucket finder.",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/clarketm/s3recon",
    packages=setuptools.find_packages(),
    include_package_data=True,
    install_requires=install_requires,
    entry_points={"console_scripts": ["s3recon=s3recon.s3recon:cli"]},
    classifiers=(
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ),
)
