6
6
import subprocess
7
7
8
8
from setuptools import setup ,Command
9
- from setuptools .command .build import build as _orig_build
9
+ from setuptools .command .build import build
10
10
11
11
try :
12
12
from babel .messages import frontend as babel
@@ -320,26 +320,27 @@ def git_describe_to_python_version(version):
320
320
vf .write (f'__version__ = "{ version } "\n ' )
321
321
322
322
323
- class build (_orig_build ):
324
- # Avoid patching the original class' attribute (more robust customisation)
325
- sub_commands = _orig_build .sub_commands [:]
323
+ class custom_build (build ):
324
+ def run (self ):
325
+ if using_translations :
326
+ self .run_command ("compile_catalog" )
327
+ if using_sphinx :
328
+ self .run_command ("build_sphinx_man" )
326
329
327
330
328
- cmdclass = {"build" :build }
331
+ cmdclass = {"build" :custom_build }
332
+
329
333
330
334
translations_dir = os .path .join ("bpython" ,"translations" )
331
335
332
336
# localization options
333
337
if using_translations :
334
- build .sub_commands .insert (0 , ("compile_catalog" ,None ))
335
-
336
338
cmdclass ["compile_catalog" ]= babel .compile_catalog
337
339
cmdclass ["extract_messages" ]= babel .extract_messages
338
340
cmdclass ["update_catalog" ]= babel .update_catalog
339
341
cmdclass ["init_catalog" ]= babel .init_catalog
340
342
341
343
if using_sphinx :
342
- build .sub_commands .insert (0 , ("build_sphinx_man" ,None ))
343
344
cmdclass ["build_sphinx_man" ]= BuildDoc
344
345
345
346
if platform .system ()in ("FreeBSD" ,"OpenBSD" ):
@@ -378,6 +379,7 @@ class build(_orig_build):
378
379
if os .path .exists (os .path .join (translations_dir ,mo_subpath )):
379
380
mo_files .append (mo_subpath )
380
381
382
+
381
383
setup (
382
384
version = version ,
383
385
data_files = data_files ,
@@ -388,6 +390,7 @@ class build(_orig_build):
388
390
},
389
391
cmdclass = cmdclass ,
390
392
test_suite = "bpython.test" ,
393
+ zip_safe = False ,
391
394
)
392
395
393
396
# vim: fileencoding=utf-8 sw=4 ts=4 sts=4 ai et sta