1

docsパッケージの epydoc を実行するターゲット (たとえば) が必要です。新しいコマンドを作成する必要があると思いますが、うまくいきません。

誰もこれを以前にやったことがありますか?

4

1 に答える 1

2

Babel プロジェクトには、ファイルで使用するためのコマンドがいくつか用意されていsetup.pyます。

distutils.commandsコマンドでエントリ ポイントを定義する必要があります。Babelsetup.pyファイルの例:

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モジュールの Babel からの例:

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.
于 2012-11-23T13:27:24.310 に答える