from setuptools import setup, find_packages
import re

package = "adamet"

def find_version(package):
    version_file = open(package + "/__init__.py").read()
    rex = r'__version__\s*=\s*"([^"]+)"'
    return re.search(rex, version_file).group(1)

def read_docstring(package):
    main_file = open(package + "/adamet.py").read()
    rex = r'def adamet[\w\W]+?:\n\s*"""([\W\w]+)"""'
    docstring = re.search(rex, main_file).group(1)
    return docstring.replace("\n    ", "\n")

setup(name=package,
      version=find_version(package),
      description="AdaMet: Adaptive Metropolis for Bayesian Analysis",
      long_description=open("README.rst").read()
                       + read_docstring(package)
                       + "\n\nLicense\n-------\n\n"
                       + open("LICENSE.txt").read(),
      long_description_content_type='text/x-rst',
      url="http://purl.org/cappellari/software",
      author="Michele Cappellari",
      author_email="michele.cappellari@physics.ox.ac.uk",
      license="Other/Proprietary License",
      packages=find_packages(),
      package_data={"": ["*.txt"]},
      data_files=["*.txt", "*.rst"],
      install_requires=["numpy", "matplotlib", "plotbin"],
      classifiers=["Development Status :: 5 - Production/Stable",
                   "Intended Audience :: Developers",
                   "Intended Audience :: Science/Research",
                   "Operating System :: OS Independent",
                   "Programming Language :: Python :: 3"],
      zip_safe=True)
