ã“ReÍã@sÒddlZddlZddlZddlmZddlmZmZmZmZddl m Z dddd gZ Gd d„dƒZ dd d„Z ddd d„Zdd d „Zdd„ZeƒdS)éN)Ú StrictVersion)Ú PKG_DIRECTORYÚ PY_COMPILEDÚ PY_SOURCEÚ PY_FROZENé)ÚBytecodeÚRequireÚ find_moduleÚget_module_constantÚextract_constantc@sseZdZdZddddd„Zdd„Zdd „Zdd d d „Zdd d„Zddd„Z dS)r z7A prerequisite to building or installing a distributionÚNcCse|dkr|dk rt}|dk rH||ƒ}|dkrHd}|jjtƒƒ|`dS)NÚ __version__)rÚ__dict__ÚupdateÚlocalsÚself)rÚnameÚrequested_versionÚmoduleZhomepageÚ attributeÚformat©rúˆ/builddir/build/BUILDROOT/alt-python35-setuptools-36.3.0-4.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/setuptools/depends.pyÚ__init__s   zRequire.__init__cCs*|jdk r#d|j|jfS|jS)z0Return full package/distribution name, w/versionNz%s-%s)rr)rrrrÚ full_name szRequire.full_namecCs=|jdkp<|jdkp<t|ƒdko<||jkS)z%Is 'version' sufficiently up-to-date?NÚunknown)rrÚstrr)rÚversionrrrÚ version_ok&szRequire.version_okrc Cs®|jdkr[y3t|j|ƒ\}}}|r=|jƒ|SWntk rZdSYnXt|j|j||ƒ}|dk rª||k rª|jdk rª|j|ƒS|S)a×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 rÚcloseÚ ImportErrorr r)rÚpathsÚdefaultÚfÚpÚiÚvrrrÚ get_version+s    ' zRequire.get_versioncCs|j|ƒdk S)z/Return true if dependency is present on 'paths'N)r()rr"rrrÚ is_presentFszRequire.is_presentcCs,|j|ƒ}|dkrdS|j|ƒS)z>Return true if dependency is present and up-to-date on 'paths'NF)r(r)rr"rrrrÚ is_currentJs zRequire.is_current) Ú__name__Ú __module__Ú __qualname__Ú__doc__rrrr(r)r*rrrrr s   c Csš|jdƒ}x„|r•|jdƒ}tj||ƒ\}}\}}}} |tkrv|pgdg}|g}q|rtd||fƒ‚qW| S)z7Just like 'imp.find_module()', but with package supportÚ.rrzCan't find %r in %s)ÚsplitÚpopÚimpr rr!) rr"ÚpartsÚpartr$ÚpathÚsuffixÚmodeÚkindÚinforrrr Rs (  c Csy%t||ƒ\}}\}}}Wntk r=dSYnXz¹|tkrl|jdƒtj|ƒ} nŠ|tkrŠtj|ƒ} nl|t kr±t |jƒ|dƒ} nE|t j krßtj ||||||fƒtt j ||dƒSWd|r |jƒXt| ||ƒS)zü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'.NéÚexec)r r!rÚreadÚmarshalÚloadrr2Úget_frozen_objectrÚcompileÚsysÚmodulesÚ load_moduleÚgetattrr r ) rÚsymbolr#r"r$r5r6r7r8Úcoderrrr es$%       c Csº||jkrdSt|jƒj|ƒ}d}d}d}|}xpt|ƒD]b}|j} |j} | |kr„|j| }qP| |kr¬| |ks¨| |kr¬|S|}qPWdS)aExtract 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'. NéZéaéd)Úco_namesÚlistÚindexrÚopcodeÚargÚ co_consts) rFrEr#Zname_idxÚ STORE_NAMEÚ STORE_GLOBALÚ LOAD_CONSTÚconstZ byte_codeÚoprNrrrr ‡s    $cCsXtjjdƒ r&tjdkr&dSd}x%|D]}tƒ|=tj|ƒq3WdS)z• Patch the globals to remove the objects not available on some platforms. XXX it'd be better to test assertions about bytecode instead. ÚjavaÚcliNr r )r r )rAÚplatformÚ startswithÚglobalsÚ__all__Úremove)Z incompatiblerrrrÚ_update_globals«s "  r\éÿÿÿÿr])rAr2r=Zdistutils.versionrrrrrZ py33compatrrZr r r r r\rrrrÚs   "C"$