1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4from setuptools import setup
5import os
6
7
8with open('README.rst') as f:
9    README = f.read()
10
11
12def get_packages(package):
13    """
14    Return root package and all sub-packages.
15    """
16    return [dirpath
17            for dirpath, dirnames, filenames in os.walk(package)
18            if os.path.exists(os.path.join(dirpath, '__init__.py'))]
19
20
21def get_package_data(package):
22    """
23    Return all files under the root package, that are not in a
24    package themselves.
25    """
26    walk = [(dirpath.replace(package + os.sep, '', 1), filenames)
27            for dirpath, dirnames, filenames in os.walk(package)
28            if not os.path.exists(os.path.join(dirpath, '__init__.py'))]
29
30    filepaths = []
31    for base, filenames in walk:
32        filepaths.extend([os.path.join(base, filename)
33                          for filename in filenames])
34    return {package: filepaths}
35
36
37setup(
38    name='djangorestframework-filters',
39    version='0.10.2',
40    url='http://github.com/philipn/django-rest-framework-filters',
41    license='MIT',
42    long_description=README,
43    description='Better filtering for Django REST Framework',
44    author='Philip Neustrom',
45    author_email='philipn@gmail.com',
46    packages=get_packages('rest_framework_filters'),
47    package_data=get_package_data('rest_framework_filters'),
48    zip_safe=False,
49    install_requires=[
50        'djangorestframework',
51        'django-filter>=1.0.0',
52    ],
53    classifiers=[
54        'Development Status :: 5 - Production/Stable',
55        'Environment :: Web Environment',
56        'Framework :: Django',
57        'Intended Audience :: Developers',
58        'License :: OSI Approved :: BSD License',
59        'Operating System :: OS Independent',
60        'Programming Language :: Python',
61        'Programming Language :: Python :: 3',
62        'Topic :: Internet :: WWW/HTTP',
63    ]
64)
65