ó ÿgdSc@s]dZddlZddlZddlZddlZddlZddlmZddlZddl m Z ddl m Z ddl mZddlmZddlmZejƒejƒejƒgZyejejƒWnek rönXejejeŒƒejd ƒd Zd „Zdd„Zd„Z d„Z!d„Z"d„Z#dS(s¿ sphinx.ext.intersphinx ~~~~~~~~~~~~~~~~~~~~~~ Insert links to objects documented in remote Sphinx documentation. This works as follows: * Each Sphinx HTML build creates a file named "objects.inv" that contains a mapping from object names to URIs relative to the HTML set's root. * Projects using the Intersphinx extension can specify links to such mapping files in the `intersphinx_mapping` config value. The mapping will then be used to resolve otherwise missing references to objects into links to the other documentation. * By default, the mapping file is assumed to be at the same location as the rest of the documentation; however, the location of the mapping file can also be specified individually, e.g. if the docs should be buildable without Internet access. :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. iÿÿÿÿN(tpath(tnodes(t relative_path(t_(tINVENTORY_FILENAME(tbsutf-8ic Csìt|ƒ}i}|jƒ}|jƒd}|jƒ}|jƒd}x›|D]“}|jƒjddƒ\}}} ||| ƒ} |dkrªd}| d|7} nd|}| d|7} ||| df|j|iƒ|Xst(Rt decompressobjtiterRt decompresstflush(t decompressortchunk(RR(s@/usr/local/lib/python2.7/site-packages/sphinx/ext/intersphinx.pyt read_chunksVs (css•tdƒ}xu|D]m}||7}|jtdƒƒ}xE|dkr|| jdƒV||d}|jtdƒƒ}q;WqW| s‘t‚dS(NRs iÿÿÿÿsutf-8i(RtfindtdecodetAssertionError(R tbufR$tlineend((s@/usr/local/lib/python2.7/site-packages/sphinx/ext/intersphinx.pyt split_lines\s   s,(?x)(.+?)\s+(\S*:\S*)\s+(\S+)\s+(\S+)\s+(.*)s py:moduleu$iÿÿÿÿ( treadlineR R't ValueErrortretmatchtgroupstendswithR(RRRRRRRRR%R+tmRRtprioRtdispname((RRs@/usr/local/lib/python2.7/site-packages/sphinx/ext/intersphinx.pytread_inventory_v2Ls2       c Cs‡|jdƒdk}|r$tjp*tj}yI|jdƒdkrWtj|ƒ}nttj|j|ƒdƒ}Wn1tk r©}|j d||j |fƒdSXyŸ|j ƒj ƒj dƒ}yV|dkrìt|||ƒ}n'|dkr t|||ƒ}nt‚|jƒWn'tk rG|jƒtd ƒ‚nXWn3tk r~}|j d ||j j|fƒnX|SdS( s6Fetch, parse and return an intersphinx inventory file.s://iÿÿÿÿtrbs4intersphinx inventory %r not fetchable due to %s: %sNsutf-8s# Sphinx inventory version 1s# Sphinx inventory version 2s(unknown or unsupported inventory versions3intersphinx inventory %r not readable due to %s: %s(R&RRt posixpathturllib2turlopentopentsrcdirt Exceptiontwarnt __class__R,R R'RR5R-tcloset__name__( tappRtinvtlocaluriRRterrRR((s@/usr/local/lib/python2.7/site-packages/sphinx/ext/intersphinx.pytfetch_inventory|s4"      cCs`ttjƒƒ}||jjd}|jj}t|dƒs_i|_i|_i|_ n|j}t }x|jj j ƒD]\}}t |tƒrÒ||}\} } |jƒsæ|jd|ƒqænd ||}} } | stj| tƒ} nd| ks-| |ks-|| d|kr|jd| ƒt|| | ƒ} | rl||| f|| ÎsiN(tintttimetconfigtintersphinx_cache_limittbuildertenvthasattrRFtintersphinx_inventorytintersphinx_named_inventorytFalsetintersphinx_mappingt iteritemst isinstancettupletisalnumR=R R7RRtinfoREtpoptTruetlistt itervaluestsortedRtupdate(RAtnowt cache_timeRNtcacheR^tkeytvalueRRRBRt cached_valst named_valsRHt unnamed_valsRRtobjects((s@/usr/local/lib/python2.7/site-packages/sphinx/ext/intersphinx.pyt load_mappingsŸsJ         # c Csé|jdƒ}|sdS|d}|j|j|dƒ}|sGdSg|D]}d||f^qN}|j|fg}d} d|krÛ|jddƒ\} } | |jkrÛ| } |j|j| | fƒqÛnx£|D]›\} }xŒ|D]„}|| ksõ|| |krqõn| ||\} }}}d|krw|jd ƒrwtj t |d |j ƒ|ƒ}nt j d d d td |d tdƒ| |fƒ}|jdƒrÊ|j|ƒn®|dksò|dkr_|ddkr_|jƒ}| rO|j| dƒrO|j|j|t| ƒd|t| ƒdƒƒqx|j|ƒn|j|j||ƒƒ|SWqâW| dk rå|jdtƒ råt|ƒråt|dt jƒråt j| |djƒ|dtlenRZRUtTextt rawsource(RARNtnodetcontnodetdomainttargettobjtypestobjtypetto_trytin_settsetnamet newtargett inventorytprojRRR4tnewnodettitle((s@/usr/local/lib/python2.7/site-packages/sphinx/ext/intersphinx.pytmissing_referenceØsL #   %   "cCsJ|jditƒ|jddtƒ|jdtƒ|jdtƒdS(NRSRLismissing-referencesbuilder-inited(tadd_config_valueRZRRtconnectRŒRh(RA((s@/usr/local/lib/python2.7/site-packages/sphinx/ext/intersphinx.pytsetup si@($t__doc__RJRtcodecsR8R7tosRR.tdocutilsRtdocutils.utilsRt sphinx.localeRtsphinx.builders.htmlRtsphinx.util.pycompatRt ProxyHandlertHTTPRedirectHandlert HTTPHandlerthandlersRwt HTTPSHandlertAttributeErrortinstall_openert build_openertlookupR RR5RERhRŒR(((s@/usr/local/lib/python2.7/site-packages/sphinx/ext/intersphinx.pyts4         0 # 9 3