1
A
回答
2
的Babel project提供了setup.py
文件使用多個命令。
您需要定義與命令的distutils.commands
切入點;例如,從Babel setup.py
file:
entry_points = """
[distutils.commands]
compile_catalog = babel.messages.frontend:compile_catalog
extract_messages = babel.messages.frontend:extract_messages
init_catalog = babel.messages.frontend:init_catalog
update_catalog = babel.messages.frontend:update_catalog
"""
其中額外命令然後可作爲python setup.py commandname
。
的入口點指向的from distutils.cmd import Command
子類。再次從巴別實施例中,從babel.messages.frontend
module:
from distutils.cmd import Command
from distutils.errors import DistutilsOptionError
class compile_catalog(Command):
"""Catalog compilation command for use in ``setup.py`` scripts."""
# Description shown in setup.py --help-commands
description = 'compile message catalogs to binary MO files'
# Options available for this command, tuples of ('longoption', 'shortoption', 'help')
# If the longoption name ends in a `=` it takes an argument
user_options = [
('domain=', 'D',
"domain of PO file (default 'messages')"),
('directory=', 'd',
'path to base directory containing the catalogs'),
# etc.
]
# Options that don't take arguments, simple true or false options.
# These *must* be included in user_options too, but without a = equals sign
boolean_options = ['use-fuzzy', 'statistics']
def initialize_options(self):
# Set a default for each of your user_options (long option name)
def finalize_options(self):
# verify the arguments and raise DistutilOptionError if needed
def run(self):
# Do your thing here.
相關問題
- 1. setup.py中的自定義分發選項
- 2. 沒有發現任何分發setup.py
- 3. epydoc和reStructuredText更改鏈接名稱
- 4. autotools和python setup.py
- 5. 爲什麼setup.py保留在我的分發包中?
- 6. 合併makefile和setup.py
- 7. 使用CMake和setup.py
- 8. distutils setup.py和%post%postun
- 9. coverage.py和setup.py和Django的測試
- 10. epydoc:固定寬度文本的塊
- 11. 如何運行win7的epydoc gui?
- 12. 替代的setup.py
- 13. 的Python setup.py的發展VS在setup.py <code>develop</code>和<code>install</code>安裝
- 14. 如何解決的setup.py的PyPI/pyserial安裝警告「未知分發選項:‘use_2to3’‘
- 15. setup.py中extras_require()和install_requires()之間的區別?
- 16. Python Setuptools分發:在setup.py中優化選項?
- 17. `和`install_requires` setup.py develop`在virtualenv中
- 18. 本地需求PIP和setup.py
- 19. setup.py的庫路徑?
- 20. Python的Setup.py文件
- 21. python庫的setup.py和依賴於發行版級別的python代碼
- 22. python setup.py開發不更新easy_install.pth
- 23. 從scons文件運行epydoc和/或pylint構建器
- 24. Python Setup.py
- 25. 如何記錄Python代碼:Epydoc,doxygen,Sphinx,...?
- 26. 如何使用epydoc生成pdf?
- 27. 在setup.py中調用另一個setup.py
- 28. setup.py添加選項(又名setup.py的--enable-功能)
- 29. setup.py找不到numpy的頭
- 30. Python中的負數extra_requires setup.py