-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
31 lines (29 loc) · 895 Bytes
/
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
import os
import subprocess
from setuptools import setup
# compile human-readable PO message catalogs into the
# machine-readable MO message catalogs used by gettext
# the MO files are included as package data
locale_dir = os.path.abspath(os.path.join(
os.path.dirname(__file__), 'a/locales'))
for locale in os.listdir(locale_dir):
subprocess.run([
'pybabel',
'compile',
'--input-file', f'{locale_dir}/{locale}/LC_MESSAGES/messages.po',
'--output-file', f'{locale_dir}/{locale}/LC_MESSAGES/messages.mo'])
setup(
name='a',
version='0.1',
packages=['a'],
package_data={
# include the compiled MO files in the package
'a': ['locales/*/LC_MESSAGES/messages.mo']
},
entry_points={
# create a command-line entrypoint
'console_scripts': [
'demo_gettext = a.interface:main'
],
}
)