Skip to content

Commit b8a706e

Browse files
committed
Rearrange some stuff and remove unused imports in setup.py
1 parent 13648c5 commit b8a706e

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

setup.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44

55
import os
66
import platform
7-
import re
8-
import sys
97

10-
from distutils import cmd
118
from distutils.command.build import build
129

1310
from bpython import __version__, package_dir
@@ -24,12 +21,19 @@
2421
except ImportError:
2522
from distutils.command.build_py import build_py
2623

27-
translations_dir = os.path.join(package_dir, 'translations')
28-
2924
try:
3025
from babel.messages.frontend import compile_catalog as _compile_catalog
3126
from babel.messages.frontend import extract_messages
27+
using_translations = True
28+
except ImportError:
29+
using_translations = False
30+
3231

32+
cmdclass = dict(build_py=build_py, build=build)
33+
translations_dir = os.path.join(package_dir, 'translations')
34+
35+
# localization options
36+
if using_translations:
3337
class compile_catalog(_compile_catalog):
3438
def initialize_options(self):
3539
"""Simply set default domain and directory attributes to the
@@ -41,28 +45,23 @@ def initialize_options(self):
4145
self.use_fuzzy = True
4246

4347
build.sub_commands.append(('compile_catalog', None))
44-
using_translations = True
45-
except ImportError:
46-
using_translations = False
48+
49+
cmdclass['compile_catalog'] = compile_catalog
50+
cmdclass['extract_messages'] = extract_messages
51+
4752

4853
if platform.system() == 'FreeBSD':
4954
man_dir = 'man'
5055
else:
5156
man_dir = 'share/man'
5257

53-
cmdclass = dict(build_py=build_py,
54-
build = build)
55-
# localization options
56-
if using_translations:
57-
cmdclass['compile_catalog'] = compile_catalog
58-
cmdclass['extract_messages'] = extract_messages
59-
60-
data_files = [
61-
# man pages
62-
(os.path.join(man_dir, 'man1'), ['doc/bpython.1']),
63-
(os.path.join(man_dir, 'man5'), ['doc/bpython-config.5']),
64-
# desktop shortcut
65-
(os.path.join('share', 'applications'), ['data/bpython.desktop'])]
58+
data_files = [
59+
# man pages
60+
(os.path.join(man_dir, 'man1'), ['doc/bpython.1']),
61+
(os.path.join(man_dir, 'man5'), ['doc/bpython-config.5']),
62+
# desktop shortcut
63+
(os.path.join('share', 'applications'), ['data/bpython.desktop'])
64+
]
6665

6766
# translations
6867
mo_files = list()

0 commit comments

Comments
 (0)