Skip to content

Commit 794bfa9

Browse files
committed
Move babel integration to setup.cfg
1 parent 0c6864b commit 794bfa9

File tree

2 files changed

+24
-48
lines changed

2 files changed

+24
-48
lines changed

setup.cfg

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
11
[metadata]
22
license_files = LICENSE
3+
4+
[init_catalog]
5+
domain = bpython
6+
input_file = bpython/translations/bpython.pot
7+
output_dir = bpython/translations
8+
9+
[compile_catalog]
10+
domain = bpython
11+
directory = bpython/translations
12+
use_fuzzy = true
13+
14+
[update_catalog]
15+
domain = bpython
16+
input_file = bpython/translations/bpython.pot
17+
output_dir = bpython/translations
18+
19+
[extract_messages]
20+
output_file = bpython/translations/bpython.pot
21+
msgid_bugs_address = https://github.com/bpython/bpython/issues

setup.py

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
from setuptools.command.install import install as _install
1111

1212
try:
13-
from babel.messages.frontend import compile_catalog as _compile_catalog
14-
from babel.messages.frontend import extract_messages as _extract_messages
15-
from babel.messages.frontend import update_catalog as _update_catalog
16-
from babel.messages.frontend import init_catalog as _init_catalog
13+
from babel.messages import frontend as babel
1714

1815
using_translations = True
1916
except ImportError:
@@ -136,52 +133,12 @@ def run(self):
136133

137134
# localization options
138135
if using_translations:
139-
140-
class compile_catalog(_compile_catalog):
141-
def initialize_options(self):
142-
"""Simply set default domain and directory attributes to the
143-
correct path for bpython."""
144-
_compile_catalog.initialize_options(self)
145-
146-
self.domain = "bpython"
147-
self.directory = translations_dir
148-
self.use_fuzzy = True
149-
150-
class update_catalog(_update_catalog):
151-
def initialize_options(self):
152-
"""Simply set default domain and directory attributes to the
153-
correct path for bpython."""
154-
_update_catalog.initialize_options(self)
155-
156-
self.domain = "bpython"
157-
self.output_dir = translations_dir
158-
self.input_file = os.path.join(translations_dir, "bpython.pot")
159-
160-
class extract_messages(_extract_messages):
161-
def initialize_options(self):
162-
"""Simply set default domain and output file attributes to the
163-
correct values for bpython."""
164-
_extract_messages.initialize_options(self)
165-
166-
self.domain = "bpython"
167-
self.output_file = os.path.join(translations_dir, "bpython.pot")
168-
169-
class init_catalog(_init_catalog):
170-
def initialize_options(self):
171-
"""Simply set default domain, input file and output directory
172-
attributes to the correct values for bpython."""
173-
_init_catalog.initialize_options(self)
174-
175-
self.domain = "bpython"
176-
self.output_dir = translations_dir
177-
self.input_file = os.path.join(translations_dir, "bpython.pot")
178-
179136
build.sub_commands.insert(0, ("compile_catalog", None))
180137

181-
cmdclass["compile_catalog"] = compile_catalog
182-
cmdclass["extract_messages"] = extract_messages
183-
cmdclass["update_catalog"] = update_catalog
184-
cmdclass["init_catalog"] = init_catalog
138+
cmdclass["compile_catalog"] = babel.compile_catalog
139+
cmdclass["extract_messages"] = babel.extract_messages
140+
cmdclass["update_catalog"] = babel.update_catalog
141+
cmdclass["init_catalog"] = babel.init_catalog
185142

186143
if using_sphinx:
187144

0 commit comments

Comments
 (0)