#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import os

from setuptools import setup, find_packages

here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()


# Find version. We have to do this because we can't import it in Python 3 until
# its been automatically converted in the setup process.
def find_version(filename):
    _version_re = re.compile(r'__version__ = "(.*)"')
    for line in open(filename):
        version_match = _version_re.match(line)
        if version_match:
            return version_match.group(1)

__version__ = find_version('pyralod/__init__.py')

requires = [
    'pyramid',
    'waitress',
    'jinja2',
    'mako',
    'rdflib>=4.0',
    ]

config = dict(
    name='pyralod',
    version=__version__,
    description='pyralod, a LOD endpoint and publisher.',
    long_description=README + '\n\n' + CHANGES,
    classifiers=[
        "Programming Language :: Python",
        "License :: OSI Approved :: BSD License",
        "Framework :: Pyramid",
        "Topic :: Internet :: WWW/HTTP",
        "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
    ],
    author="Graham Higgins",
    author_email="gjhiggins@gmail.com",
    url="https://github.com/RDFLib/rdfextras-pyramidlod",
    license="BSD",
    platforms=["any"],
    keywords='web wsgi bfg pylons pyramid',
    packages=find_packages(),
    include_package_data=True,
    zip_safe=False,
    test_suite='pyralod',
    install_requires=requires,
    entry_points="""\
        [paste.app_factory]
        main=pyralod:main
        [console_scripts]
        initialize_pyralod_db=pyralod.scripts.initializedb:main
        sparqlendpointapp=pyralod.lib.endpoint:main
        rdflodapp=pyralod.lib.lod:main
        [rdf.plugins.serializer]
        html=pyralod.lib.htmlresults:HTMLSerializer
        [rdf.plugins.resultserializer]
        html=pyralod.lib.htmlresults:HTMLResultSerializer
    """
)

setup(**config)
