-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
103 lines (82 loc) · 2.84 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
"""
Flask-BabelPlus
---------------
Adds i18n/l10n support to Flask applications with the help of the
`Babel`_ library.
This is a fork of Flask-BabelEx which in turn is a fork of the official
Flask-Babel extension. It is API compatible with both forks.
It comes with following additional features:
1. It is possible to use multiple language catalogs in one Flask application;
2. Localization domains: your extension can package localization file(s) and
use them if necessary;
3. Does not reload localizations for each request.
The main difference to Flask-BabelEx is, that you can pass arguments to the
``init_app`` method as well.
.. code:: python
# Flask-BabelPlus with custom domain
babel.init_app(app=app, default_domain=FlaskBBDomain(app))
Links
`````
* `Documentation <http://packages.python.org/Flask-BabelPlus>`_
* `Flask-BabelEx <https://github.com/mrjoes/flask-babelex>`_
* `original Flask-Babel <https://pypi.python.org/pypi/Flask-Babel>`_.
.. _Babel: https://github.com/python-babel/babel
"""
import ast
import re
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTestCommand(TestCommand):
user_options = [("pytest-args=", "a", "Arguments to pass to pytest")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = []
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
with open('flask_babelplus/__init__.py', 'rb') as f:
version_line = re.search(
r'__version__\s+=\s+(.*)', f.read().decode('utf-8')
).group(1)
version = str(ast.literal_eval(version_line))
setup(
name='Flask-BabelPlus',
version=version,
url='https://github.com/sh4nks/flask-babelplus',
license='BSD',
author='Peter Justin',
author_email='[email protected]',
description='Adds i18n/l10n support to Flask applications',
long_description=__doc__,
packages=['flask_babelplus'],
include_package_data=True,
zip_safe=False,
install_requires=[
'pytz>=2020.1',
'Flask>=1.0',
'Babel>=2.0',
],
tests_require=[
"py",
"pytest",
"pytest-cov"
],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules'
],
cmdclass={"test": PyTestCommand}
)