Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1f2f6f5

Browse files
committed
Refactor build command overrides
1 parentff05288 commit1f2f6f5

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

‎setup.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
importsubprocess
77

88
fromsetuptoolsimportsetup,Command
9-
fromsetuptools.command.buildimportbuildas_orig_build
9+
fromsetuptools.command.buildimportbuild
1010

1111
try:
1212
frombabel.messagesimportfrontendasbabel
@@ -320,26 +320,27 @@ def git_describe_to_python_version(version):
320320
vf.write(f'__version__ = "{version}"\n')
321321

322322

323-
classbuild(_orig_build):
324-
# Avoid patching the original class' attribute (more robust customisation)
325-
sub_commands=_orig_build.sub_commands[:]
323+
classcustom_build(build):
324+
defrun(self):
325+
ifusing_translations:
326+
self.run_command("compile_catalog")
327+
ifusing_sphinx:
328+
self.run_command("build_sphinx_man")
326329

327330

328-
cmdclass= {"build":build}
331+
cmdclass= {"build":custom_build}
332+
329333

330334
translations_dir=os.path.join("bpython","translations")
331335

332336
# localization options
333337
ifusing_translations:
334-
build.sub_commands.insert(0, ("compile_catalog",None))
335-
336338
cmdclass["compile_catalog"]=babel.compile_catalog
337339
cmdclass["extract_messages"]=babel.extract_messages
338340
cmdclass["update_catalog"]=babel.update_catalog
339341
cmdclass["init_catalog"]=babel.init_catalog
340342

341343
ifusing_sphinx:
342-
build.sub_commands.insert(0, ("build_sphinx_man",None))
343344
cmdclass["build_sphinx_man"]=BuildDoc
344345

345346
ifplatform.system()in ("FreeBSD","OpenBSD"):
@@ -378,6 +379,7 @@ class build(_orig_build):
378379
ifos.path.exists(os.path.join(translations_dir,mo_subpath)):
379380
mo_files.append(mo_subpath)
380381

382+
381383
setup(
382384
version=version,
383385
data_files=data_files,
@@ -388,6 +390,7 @@ class build(_orig_build):
388390
},
389391
cmdclass=cmdclass,
390392
test_suite="bpython.test",
393+
zip_safe=False,
391394
)
392395

393396
# vim: fileencoding=utf-8 sw=4 ts=4 sts=4 ai et sta

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp