<reponame>evansmurithi/django-rest-framework-files
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import re

from setuptools import setup

try:
    from pypandoc import convert_file

    def read_md(f):
        return convert_file(f, 'rst')

except ImportError:
    print(
        "warning: pypandoc module not found, could not convert Markdown to RST"
    )

    def read_md(f):
        return open(f, 'r').read()


def get_version(package):
    """
    Return package version as listed in `__version__` in `__init__.py`.
    """
    init_py = open(os.path.join(package, '__init__.py')).read()
    return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)


def get_packages(package):
    """
    Return root package and all sub-packages.
    """
    return [
        dirpath for dirpath, dirnames, filenames in os.walk(package)
        if os.path.exists(os.path.join(dirpath, '__init__.py'))
    ]


package = 'rest_framework_files'
version = get_version(package)


setup(
    name='djangorestframework-files',
    version=version,
    url='https://github.com/evansmurithi/django-rest-framework-files',
    license='MIT License',
    description='File download and upload support for Django REST framework',
    long_description=read_md('README.md'),
    author='<NAME>',
    author_email='<EMAIL>',
    packages=get_packages(package),
    install_requires=[],
    classifiers=[
        'Development Status :: 4 - Beta',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Framework :: Django :: 1.11',
        'Framework :: Django :: 2.0',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Topic :: Internet :: WWW/HTTP',
    ]
)
