44
55import os
66import platform
7- import re
8- import sys
97
10- from distutils import cmd
118from distutils .command .build import build
129
1310from bpython import __version__ , package_dir
2421except ImportError :
2522 from distutils .command .build_py import build_py
2623
27- translations_dir = os .path .join (package_dir , 'translations' )
28-
2924try :
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
4853if platform .system () == 'FreeBSD' :
4954 man_dir = 'man'
5055else :
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
6867mo_files = list ()
0 commit comments