2012-11-23 2 views
1

내 패키지에 epydoc을 실행하는 대상 (예 : docs)을 갖고 싶습니다. 나는 새로운 명령을 만들어야한다고 가정하지만 나는 많은 운이 없다.Distribute, epydoc 및 setup.py

이전에이 작업을 수행 한 사람이 있습니까?

답변

2

Babel projectsetup.py 파일에 사용할 수있는 몇 가지 명령을 제공합니다.

distutils.commands 진입 점을 명령과 함께 정의해야합니다. Babel setup.py file에서 예 : 추가 명령은 다음 python setup.py commandname로 사용할 수 있습니다

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 
""" 

.

엔트리 포인트는 서브 클래스 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.