�9�c@sdZddlZy:ddlmZmZddlmZddlmZWne k
r_nXddl
mZddlm
Z
ddlmZdd lmZdd
lmZddlmZd�Zd
�Zdefd��YZdefd��YZd�ZdS(s�
Adds a sphinx directive that can be used to automatically document a plugin.
this::
.. autoplugin :: nose.plugins.foo
:plugin: Pluggy
produces::
.. automodule :: nose.plugins.foo
Options
-------
.. cmdoption :: --foo=BAR, --fooble=BAR
Do the foo thing to the new thing.
Plugin
------
.. autoclass :: nose.plugins.foo.Pluggy
:members:
Source
------
.. include :: path/to/nose/plugins/foo.py
:literal:
i�N(tnodestutils(tViewList(t
directives(tresolve_name(tPlugin(tBuiltinPluginManager(tConfig(tTestProgram(tisclassc Cs�|d} t| �}
|jdd�}|r@t|
|�}nax^t|
�D]P}
t|
|
�}t|�rMt|t�rM|tk rMd| |
f}PqMqMWt�}|j d| d�|j dd�|j dd�|j dd�|j dd�|�}t
�}|j|i�x_|D]W}|j |j�d�|j d d�|j d
|jdd�|j dd�q'W|j dd�|j d
d�|j dd�|j d|d�|j dd�|j dd�|j dd�|j dd�|j d
d�|j dt
j|jdtjj|
jjdd���d�|j dd�|j dd�tj�}|j|_|jj}|jj}g|j_d|j_|j|d|dd�||j_||j_|jS(Nitplugins%s.%ss.. automodule :: %s
s <autodoc>ttOptionss-------s
s s
Rs------s.. autoclass :: %s
s
:members:
s :show-inheritance:
tSources.. include :: %s
tsources.pycs.pys
:literal:
tmatch_titlesi(RtgettNonetgetattrtdirR t
issubclassRRtappendt OptBuckettoptionsthelpRt
relative_pathtdocumenttostpathtabspatht__file__treplaceRtsectiontmemottitle_stylest
section_leveltnested_parsetchildren(tdirnamet argumentsRtcontenttlinenotcontent_offsett
block_texttstatet
state_machinetmod_nametmodt plug_nametobjtentrytrsttplugtoptstopttnodetsurrounding_title_stylestsurrounding_section_level((s:/sys/lib/python2.7/site-packages/nose/sphinx/pluginopts.pytautoplugin_directive1sd
'
"c Csxtdtdt��} | jtj��}
t�}x-|
j�jd�D]}|j |d�qLW|j dd�|j dd�|j dd�x_|
D]W}
|j |
j
�d�|j dd�|j d |
jdd�|j dd�q�Wtj
�}|j|_|jj}|jj}g|j_d
|j_|j|d
|dd�||j_||j_|jS(
sproduces rst from nose helptparserClasstpluginss
s <autodoc>Rs-------Rs
s iRi(RRRt getParserRtusageRtformat_helptsplitRRRRR RR!R"R#R$R%(R&R'RR(R)R*R+R,R-tconfigtparserR3tlineR6R7R8R9((s:/sys/lib/python2.7/site-packages/nose/sphinx/pluginopts.pytautohelp_directivets0
RcBs2eZddd�Zd�Zd�Zd�ZRS(t nosetestscCsg|_||_||_dS(N(R5tdoctprog(tselfRFRG((s:/sys/lib/python2.7/site-packages/nose/sphinx/pluginopts.pyt__init__�s cCs
t|j�S(N(titerR5(RH((s:/sys/lib/python2.7/site-packages/nose/sphinx/pluginopts.pyt__iter__�scCs"|jjd|j�jdd�S(Ns%progs:
s::
(RFRRG(RH((s:/sys/lib/python2.7/site-packages/nose/sphinx/pluginopts.pyR?�scOs|jjt||��dS(N(R5RtOpt(RHtargtkw((s:/sys/lib/python2.7/site-packages/nose/sphinx/pluginopts.pyt
add_option�sN(t__name__t
__module__RRIRKR?RO(((s:/sys/lib/python2.7/site-packages/nose/sphinx/pluginopts.pyR�s RLcBs#eZd�Zd�Zd�ZRS(cOsa||_|jdd�|_|jdd�|_|jdd�|_|jdd�|_dS(NtactiontdefaulttmetavarR(R5tpopRRRRSRTR(RHRMRN((s:/sys/lib/python2.7/site-packages/nose/sphinx/pluginopts.pyRI�s
cCsgg}xM|jD]B}|}|jdkrE|d|j|�7}n|j|�qWddj|�S(Nt
store_truetstore_falses=%ss.. cmdoption :: s, (RVRW(R5RRtmetaRtjoin(RHtbuft optstringtdesc((s:/sys/lib/python2.7/site-packages/nose/sphinx/pluginopts.pyR�scCs
|jpdS(NtDEFAULT(RT(RHR[((s:/sys/lib/python2.7/site-packages/nose/sphinx/pluginopts.pyRX�s(RPRQRIRRX(((s:/sys/lib/python2.7/site-packages/nose/sphinx/pluginopts.pyRL�s cCs9|jdtdddtj�|jdtdd�dS(Nt
autopluginiiR
tautohelp(iii(iii(t
add_directiveR:Rt unchangedRD(tapp((s:/sys/lib/python2.7/site-packages/nose/sphinx/pluginopts.pytsetup�s
(t__doc__RtdocutilsRRtdocutils.statemachineRtdocutils.parsers.rstRtImportErrort nose.utilRtnose.plugins.baseRtnose.plugins.managerRtnose.configRt nose.coreRtinspectR R:RDtobjectRRLRc(((s:/sys/lib/python2.7/site-packages/nose/sphinx/pluginopts.pyt<module> s$
C
|