ó ÿgdSc@sèdZddlZddlmZyddlZddlZWnek r[eZZnXddlmZddl m Z m Z ddl m Z mZmZmZddlmZddlmZd efd „ƒYZid d fd 6d d fd6d dfd6d dfd6d dfd6d dfd6ddfd6ddfd6ddfd6ddfd6ddfd6d d!fd 6d"d#fd$6d%d&fd%6d'd(fd'6d)d*fd)6d+d,fd+6d-d.fd-6d/d0fd/6d/d1fd26ZdS(3sÅ sphinx.builders ~~~~~~~~~~~~~~~ Builder superclass for all builders. :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. iÿÿÿÿN(tpath(tnodes(tSEPt relative_uri(tboldtpurplet darkgreentterm_width_line(troles(t directivestBuildercBseZdZdZdZdZeZd„Zd„Z d„Z dd„Z dd„Z d„Zed „d „Zed d „d „ZgZd„Zd„Zd„Zd„Zddd„Zdd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z RS(s6 Builds target formats from the reST sources. ttnonecCs|j|_|jj|jƒ|j|_|j|_|j|_|j|_tj|jƒstt j |jƒn||_ |j |_ |j |_ |j|_|j|_|jj|jƒ|jj|jƒ|jjd|jƒ|jjd|jƒi|_|jƒdS(Ns format_%ss builder_%s(tenvtset_versioning_methodtversioning_methodtsrcdirtconfdirtoutdirt doctreedirRtisdirtostmakedirstapptwarntinfotconfigttagstaddtformattnametimagestinit(tselfR((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyt__init__-s&           cCsdS(soLoad necessary templates and perform initialization. The default implementation does nothing. N((R!((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyR GscCsP|jjr0|jj|jjdƒƒ|_nddlm}|ƒ|_dS(s&Return the template bridge configured.stemplate_bridge settingiÿÿÿÿ(tBuiltinTemplateLoaderN(Rttemplate_bridgeRt import_objectt templatestsphinx.jinja2glueR#(R!R#((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pytcreate_template_bridgeMs   cCs t‚dS(s’Return the target URI for a document name. *typ* can be used to qualify the link characteristic for individual builders. N(tNotImplementedError(R!tdocnamettyp((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pytget_target_uriVscCs"t|j|ƒ|j||ƒƒS(sReturn a relative URI between two source filenames. May raise environment.NoUri if there's no way to return a sensible URI. (RR,(R!tfrom_ttoR+((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pytget_relative_uri^scCs t‚dS(sDReturn an iterable of output files that are outdated, or a string describing what an update build will build. If the builder does not output individual files corresponding to source files, return a string here. If it does, return an iterable of those files that need to be written. N(R)(R!((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pytget_outdated_docsfscCs|S(N((tx((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pytqsccsŠd}xd|D]\}|dkrA|jt|ƒddƒd}n|j|||ƒƒdddƒ|Vq W|dkr†|jƒndS(Nitnonlit (RR(R!titerabletsummaryt colorfunctstringify_functltitem((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pytold_status_iteratorps   #  icCs|S(N((R1((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyR2~sc csæ|dkr8x%|j||||ƒD] }|Vq%WdSd}t|ƒ}x||D]t}|d7}d|d|||||ƒƒf}|jjr¡|d7}n t|ƒ}|j|ddƒ|VqQW|dkrâ|jƒndS(Niis %s[%3d%%] %sids R3(R;RRt verbosityRR( R!R5R6R7tlengthR8R:R9ts((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pytstatus_iterator}s$           c Csùxò|jtjƒD]Þ}d|dkr/qnd|dkr´xe|jD]&}|dj|d ƒ}|rIPqIqIW|jd|dd|jt|ddƒfƒq||dOnly rebuild as much as needed for changes in the *filenames*.isIfile %r given on command line is not under the source directory, ignorings6file %r given on command line does not exist, ignoringRQtspecificR6s%%d source files given on command lineN(tlenRRt source_suffixRtnormpathtabspatht startswithRtisfiletendswithtreplacetsepRtappendRS(R!t filenamestdirlentto_writetsuffixtfilename((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pytbuild_specific³s*   "  cCs^|jƒ}t|tƒr1|jdg|ƒn)t|ƒ}|j|ddt|ƒƒdS(s8Only rebuild what was changed or added since last build.t__all__R6s0targets for %d source files that are out of dateN(R0t isinstancetstrRStlistRV(R!tto_build((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyt build_updateÍs   tupdatecs-|r6|jtd|jƒddƒ|j|ƒntƒ}g‰|jj‡fd†ƒ|jtdƒddƒ|jj|j|j|j |j ƒ\}}}|j|ƒx-|j |dt |ƒD]}|j |ƒqÍWxˆD]} |j| ŒqëW|jj|jƒt|ƒ} |jtdƒddƒx'|jj|ƒD]}|j |ƒqMWt|ƒ| } | rŽ|jd| ƒn |jd ƒ|r,d d lm} |jtd ƒdtƒ|jjtj|j | ƒƒ|jd ƒ|jtdƒdtƒ|jjƒ|jd ƒn*|dkrV| rV|jtdƒƒdS|r„|dgkr„t|ƒ|jj@}n|j|t|ƒ|ƒ|jƒ|j jdkr¿dpÂd} |j jr|jtd| |j j|j jdkrdpdfƒƒn|jtd| ƒƒdS(saMain build method. First updates the environment, and then calls :meth:`write`. sbuilding [%s]: R3ics ˆj|ƒS(N(R_(targs(twarnings(sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyR2ässupdating environment: sreading sources... s"looking for now-outdated files... s%d founds none foundiÿÿÿÿ(tENV_PICKLE_FILENAMEspickling environment... tdoneschecking consistency... Rlsno targets are out of date.NRfit succeededsfinished with problemssbuild %s, %s warning%s.R>R s build %s.(RRRtsetR t set_warnfuncRlRRRRR?RRRRVtcheck_dependentstsphinx.applicationRotTruettopickleRtjointcheck_consistencyt found_docstwriteRitfinisht statuscodet _warncount(R!tdocnamesR6RQtupdated_docnamestmsgR=titeratorR*twarningtdoccounttoutdatedRotstatus((RnsB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyRSØs\            )csÄ|dks|dgkr*|jj}n|dkrOt|ƒt|ƒB}n t|ƒ}|jjddjt|ƒƒƒxYt|ƒD]K}xB|jj j |gƒD](}||jjkr©|j |ƒq©q©WqŠW|j |j j ƒ|jtdƒdtƒ|j|ƒ|jdƒg‰|jj‡fd†ƒtok|jjd kok|joktjd ks‡|jt|ƒˆƒn&|jt|ƒˆd |jjd ƒ|jj|jƒdS( NRfRlsdocnames to write: %ss, spreparing documents... R3Rpcs ˆj|ƒS(N(R_(Rm(Rn(sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyR28sitposixtnproc(RIR RzRrRtdebugRxtsortedRitfiles_to_rebuildRHRRt master_docRRRvtprepare_writingRstmultiprocessingtparalleltallow_parallelRRt _write_serialt_write_parallelR(R!tbuild_docnamesR€RQRR*t tocdocname((RnsB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyR{!s0  "   cCs€x[|j|dtt|ƒƒD];}|jj||ƒ}|j||ƒ|j||ƒqWx|D]}|j|ŒqeWdS(Nswriting output... (R?RRVR tget_and_resolve_doctreetwrite_doc_serializedt write_docR(R!RRnR*RLRƒ((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyR‘Hs  cs ‡‡fd†‰‡‡fd†}tj|ƒ‰g}|d|d}}ˆjj|ˆƒ}ˆj||ƒˆj||ƒt|ƒ}t||dƒ} | dkr·d} nt|| ƒ\} } | rß| d7} ngt | ƒD]} || | | d| !^qì} xĈj | dt t| ƒd„ƒD]ž}g}xF|D]>}ˆjj|ˆƒ}ˆj||ƒ|j ||fƒqIWˆj ƒtjd|d |fƒ}|jtƒ|jƒ|j |ƒq6Wˆjtd ƒƒx|D]}|jƒqòWdS( NcsizCy+x$|D]\}}ˆj||ƒq WWntk rAnXWdxˆD]}ˆj|ŒqMWXdS(N(R—tKeyboardInterruptR(tdocsR*RLRƒ(R!Rn(sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyt write_processRs  cs=tjdˆd|fƒ}|jƒ|jƒˆjƒdS(NttargetRm(RŽtProcesststartRxtrelease(R™tp(t semaphoreRš(sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pytprocess_thread\s  iii swriting output... cSsd|d|dfS(Ns%s .. %siiÿÿÿÿ((tchk((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyR2xsR›Rmswaiting for workers... (t threadingt SemaphoreR R•R–R—RVtmintdivmodtrangeR?RR_tacquiretThreadt setDaemonRvRRRRx(R!RRnRˆR¡tthreadst firstnameRLtndocst chunksizetnchunkstresttitchunksR™R*tt((R!R RnRšsB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyR’Qs@     2      cCs t‚dS(s?A place where you can add logic before :meth:`write_doc` is runN(R)(R!R((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyRŠscCs t‚dS(s5Where you actually write something to the filesystem.N(R)(R!R*RL((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyR—ŽscCsdS(soHandle parts of write_doc that must be called in the main process if parallel build is active. N((R!R*RL((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyR–’scCsdS(sWFinish the building process. The default implementation does nothing. N((R!((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyR|˜scCsdS(sQCleanup any resources. The default implementation does nothing. N((R!((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pytcleanupŸscCs\y'd|j|f}t|j|ƒSWn.tk rWd||f}t|j|ƒSXdS(s÷Return a builder specific option. This method allows customization of common builder settings by inserting the name of the current builder in the option key. If the key does not exist, use default as builder name. s%s_%sN(RRKRtAttributeError(R!toptiontdefaulttoptname((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pytget_builder_config¦s  N(!t__name__t __module__t__doc__RRRtFalseRR"R R(RIR,R/R0RR;R?RGRPRTReRkRSR{R‘R’RR—R–R|R´R¹(((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyR s<          I ' 9     thtmltStandaloneHTMLBuildertDirectoryHTMLBuildertdirhtmltSingleFileHTMLBuildert singlehtmltPickleHTMLBuildertpickletJSONHTMLBuildertjsontwebthtmlhelptHTMLHelpBuildertdevhelptDevhelpBuildertqthelpt QtHelpBuildertepubt EpubBuildertlatext LaTeXBuilderttextt TextBuildertmanpagetManualPageBuildertmanttexinfotTexinfoBuildertchangestChangesBuildert linkchecktCheckExternalLinksBuildert websupporttWebSupportBuildertgettexttMessageCatalogBuildertxmlt XMLBuildertPseudoXMLBuildert pseudoxml(R¼RRRŽR£t ImportErrorRItdocutilsRtsphinx.util.osutilRRtsphinx.util.consoleRRRRtsphinxRR tobjectR tBUILTIN_BUILDERS(((sB/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.pyt sF   "ÿ˜