ó kŽšSc@sĎddlZddlZddlZddlmZmZmZmZddlmZddl m Z ddddgZ ddd „ƒYZ d „Z dd „Zddd „Zdd „Zd„ZeƒdS(i˙˙˙˙N(t PKG_DIRECTORYt PY_COMPILEDt PY_SOURCEt PY_FROZEN(t StrictVersion(tcompattRequiret find_moduletget_module_constanttextract_constantcBsYeZdZdd d d„Zd„Zd„Zd dd„Zd d„Zd d„Z RS( s7A prerequisite to building or installing a distributiontcCsn|dkr!|dk r!t}n|dk rQ||ƒ}|dkrQd}qQn|jjtƒƒ|`dS(Nt __version__(tNoneRt__dict__tupdatetlocalstself(Rtnametrequested_versiontmodulethomepaget attributetformat((s</usr/local/lib/python2.7/site-packages/setuptools/depends.pyt__init__s     cCs*|jdk r#d|j|jfS|jS(s0Return full package/distribution name, w/versions%s-%sN(RR R(R((s</usr/local/lib/python2.7/site-packages/setuptools/depends.pyt full_namescCs=|jdkp<|jdkp<t|ƒdko<||jkS(s%Is 'version' sufficiently up-to-date?tunknownN(RR RtstrR(Rtversion((s</usr/local/lib/python2.7/site-packages/setuptools/depends.pyt version_ok#sRcCs°|jdkr]y6t|j|ƒ\}}}|r@|jƒn|SWq]tk rYdSXnt|j|j||ƒ}|dk rŹ||k rŹ|jdk rŹ|j|ƒS|S(s×Get version number of installed module, 'None', or 'default' Search 'paths' for module. If not found, return 'None'. If found, return the extracted version attribute, or 'default' if no version attribute was specified, or the value cannot be determined without importing the module. The version is formatted according to the requirement's version format (if any), unless it is 'None' or the supplied 'default'. N(RR RRtcloset ImportErrorRR(Rtpathstdefaulttftptitv((s</usr/local/lib/python2.7/site-packages/setuptools/depends.pyt get_version(s   ' cCs|j|ƒdk S(s/Return true if dependency is present on 'paths'N(R%R (RR((s</usr/local/lib/python2.7/site-packages/setuptools/depends.pyt is_presentCscCs,|j|ƒ}|dkrtS|j|ƒS(s>Return true if dependency is present and up-to-date on 'paths'N(R%R tFalseR(RRR((s</usr/local/lib/python2.7/site-packages/setuptools/depends.pyt is_currentGs N( t__name__t __module__t__doc__R RRRR%R&R((((s</usr/local/lib/python2.7/site-packages/setuptools/depends.pyR s   c csďddlm}ddlm}m}|d|jƒ}t|jƒ}d}d}x•||krę||}||krĚ||d||dd|} |d 7}||krÜ| tjd ƒ}qVqÜnd } |d7}|| fVqVWd S( s>Yield '(op,arg)' pair for each operation in code object 'code'i˙˙˙˙(tarray(t HAVE_ARGUMENTt EXTENDED_ARGtbiiiiiiN( R,tdisR-R.tco_codetlenRt long_typeR ( tcodeR,R-R.tbytesteoftptrt extended_argtoptarg((s</usr/local/lib/python2.7/site-packages/setuptools/depends.pyt _iter_codeOs"  "    c Cs|jdƒ}x‡|r˜|jdƒ}tj||ƒ\}}\}}}} |tkrv|pgdg}|g}q|rtd||fƒ‚qqW| S(s7Just like 'imp.find_module()', but with package supportt.iRsCan't find %r in %s(tsplittpoptimpRRR( RRtpartstpartR!tpathtsuffixtmodetkindtinfo((s</usr/local/lib/python2.7/site-packages/setuptools/depends.pyRps (  c Csy%t||ƒ\}}\}}}Wntk r9dSXzź|tkrh|jdƒtj|ƒ} n|tkr†tj |ƒ} no|t kr­t |jƒ|dƒ} nH|t j krŢtj||||||fƒntt j ||dƒSWd|r |jƒnXt| ||ƒS(süFind 'module' by searching 'paths', and extract 'symbol' Return 'None' if 'module' does not exist on 'paths', or it does not define 'symbol'. If the module defines 'symbol' as a constant, return the constant. Otherwise, return 'default'.itexecN(RRR RtreadtmarshaltloadRR?tget_frozen_objectRtcompiletsystmodulest load_moduletgetattrRR ( RtsymbolR RR!RBRCRDRER4((s</usr/local/lib/python2.7/site-packages/setuptools/depends.pyRƒs$%     "c CsŽ||jkrdSt|jƒj|ƒ}d}d}d}|}xdt|ƒD]V\}} ||krx|j| }qP| |kr ||ksœ||kr |S|}qPWdS(sExtract the constant value of 'symbol' from 'code' If the name 'symbol' is bound to a constant value by the Python code object 'code', return that value. If 'symbol' is bound to an expression, return 'default'. Otherwise, return 'None'. Return value is based on the first assignment to 'symbol'. 'symbol' must be a global, or at least a non-"fast" local in the code block. That is, only 'STORE_NAME' and 'STORE_GLOBAL' opcodes are checked, and 'symbol' must be present in 'code.co_names'. iZiaidN(tco_namesR tlisttindexR;t co_consts( R4RQR tname_idxt STORE_NAMEt STORE_GLOBALt LOAD_CONSTtconstR9R:((s</usr/local/lib/python2.7/site-packages/setuptools/depends.pyR Śs  $cCsXtjjdƒ r&tjdkr&dSd}x%|D]}tƒ|=tj|ƒq3WdS(s• Patch the globals to remove the objects not available on some platforms. XXX it'd be better to test assertions about bytecode instead. tjavatcliNR R(sextract_constantsget_module_constant(RMtplatformt startswithtglobalst__all__tremove(t incompatibleR((s</usr/local/lib/python2.7/site-packages/setuptools/depends.pyt_update_globalsÉs "  ((RMR?RIRRRRtdistutils.versionRt setuptoolsRR`RR;R RRR Rc(((s</usr/local/lib/python2.7/site-packages/setuptools/depends.pyts   "C ! # #