# coding: utf8
"""Small extension for Flask to make usage of Gravatar service easy."""
import os
import re
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]
def initialize_options(self):
TestCommand.initialize_options(self)
try:
from ConfigParser import ConfigParser
except ImportError:
from configparser import ConfigParser
config = ConfigParser()
config.read("pytest.ini")
self.pytest_args = config.get("pytest", "addopts").split(" ")
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
# Get the version string. Cannot be done with import!
with open(os.path.join('flask_gravatar', 'version.py'), 'rt') as f:
version = re.search(
'__version__\s*=\s*"(?P<version>.*)"\n',
f.read()
).group('version')
tests_require = [
'pytest-cache>=1.0',
'pytest-cov>=1.8.0',
'pytest-pep8>=1.0.6',
'pytest>=2.6.1',
'coverage<4.0a1'
]
setup(
name='Flask-Gravatar',
version=version,
author='Alexander Zelenyak aka ZZZ',
author_email='zzz.sochi@gmail.com',
description=__doc__,
license='BSD',
long_description=open('README.rst').read(),
platforms='any',
url='https://github.com/zzzsochi/Flask-Gravatar/',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules',
],
install_requires=[
'Flask',
],
extras_require={
'docs': ['sphinx'],
},
tests_require=tests_require,
cmdclass={'test': PyTest},
packages=['flask_gravatar'],
)