from setuptools import setup, Command
import sys

long_description = (
    open('README.txt').read()
    + '\n' +
    open('CHANGES.txt').read())


install_requires = [
    'WebOb >= 1.2',
    'setuptools',
]

if sys.version_info < (2, 7):
    install_requires.append('argparse')

if sys.version_info < (3,):
    install_requires.append('which')
else:
    install_requires.append('which==1.1.3.py3')

tests_require = [
    'pytest >= 2.3',
    'cssmin',
    'jsmin',
    'closure',
    'pytest-capturelog',
]

class PyTest(Command):
    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        import sys
        import subprocess
        errno = subprocess.call([sys.executable, 'runtests.py'])
        raise SystemExit(errno)

setup(
    name='fanstatic',
    version='0.17dev',
    description="Flexible static resources for web applications",
    classifiers=[
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
        'Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.2',
        'Programming Language :: Python :: 3.3',
        'Development Status :: 5 - Production/Stable'
    ],
    keywords='',
    author='Fanstatic Developers',
    author_email='fanstatic@googlegroups.com',
    long_description=long_description,
    license='BSD',
    url='http://fanstatic.org',
    packages=['fanstatic'],
    zip_safe=False,
    install_requires=install_requires,
    tests_require=tests_require,
    extras_require={'test': tests_require},
    cmdclass={'test': PyTest},
    entry_points={
        'console_scripts': [
            'fanstatic-compile = fanstatic.compiler:compile_resources',
        ],
        'paste.filter_app_factory': [
            'fanstatic = fanstatic:make_fanstatic',
            'publisher = fanstatic:make_publisher',
            'injector = fanstatic:make_injector',
        ],
        'paste.app_factory': [
            'serf = fanstatic:make_serf',
        ],
        'fanstatic.compilers': [
            'coffee = fanstatic.compiler:COFFEE_COMPILER',
            'less = fanstatic.compiler:LESS_COMPILER',
            'sass = fanstatic.compiler:SASS_COMPILER',
        ],
        'fanstatic.minifiers': [
            'cssmin = fanstatic.compiler:CSSMIN_MINIFIER',
            'jsmin = fanstatic.compiler:JSMIN_MINIFIER',
            'closure = fanstatic.compiler:CLOSURE_MINIFIER',
        ]
    })

@@ -421,21 +421,15 @@
    '
-pytest %3E= 2.3
+closure
 ',%0A 
@@ -455,31 +455,37 @@
 smin',%0A    '
-closure
+pytest %3E= 2.3
 ',%0A    'pyte
@@ -1790,16 +1790,115 @@
 equire=%7B
+%0A        'closure': %5B'closure'%5D,%0A        'cssmin': %5B'cssmin'%5D,%0A        'jsmin': %5B'jsmin'%5D,%0A        
 'test': 
@@ -1910,16 +1910,22 @@
 _require
+,%0A    
 %7D,%0A    c

add python extras_require for compilers.