N3{YM@sddlmZddlZddlZddlZddlmZmZmZmZddl m Z m Z ddddgZ Gd ddZ d d Zdd dZddddZdddZejjdsejdkr[[e jde jdndS)) generatorsN) PKG_DIRECTORY PY_COMPILED PY_SOURCE PY_FROZEN) StrictVersion LooseVersionRequire find_moduleget_module_constantextract_constantc@sseZdZdZdddddZddZdd Zdd d d Zdd dZdddZ dS)r z7A prerequisite to building or installing a distributionNcCsn|dkr!|dk r!t}n|dk rQ||}|dkrQd}qQn|jjt|`dS)N __version__)r__dict__updatelocalsself)rnamerequested_versionmodulehomepage attributeformatr-/tmp/pip-r2rszybt-build/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_nameszRequire.full_namecCs=|jdkp<|jdkp<t|dko<||jkS)z%Is 'version' sufficiently up-to-date?Nunknown)rrstrr)rversionrrr version_ok$szRequire.version_okrc Cs|jdkray6t|j|\}}}|r@|jn|SWqatk r]dSYqaXnt|j|j||}|dk r||k r|jdk r|j|S|S)aGet 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 rclose ImportErrorr r)rpathsdefaultfpivrrr 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_currentKs zRequire.is_current) __name__ __module__ __qualname____doc__rrr r)r*r+rrrrr s   c csddlm}ddlm}m}|d|j}t|j}d}d}x||kr||}||kr||d||dd|} |d7}||kr| td }qVqnd } |d7}|| fVqVWd S) z>Yield '(op,arg)' pair for each operation in code object 'code'r)array) HAVE_ARGUMENT EXTENDED_ARGbiN)r0Zdisr1r2co_codelenZ long_type) coder0r1r2byteseofptrZ extended_argopargrrr _iter_codeSs"  "    r@c Cs|jd}x|r|jd}tj||\}}\}}}} |tkrv|pgdg}|g}q|rtd||fqqW| S)z7Just like 'imp.find_module()', but with package support.rrzCan't find %r in %s)splitpopimpr rr") rr#partspartr%pathsuffixmodekindinforrrr |s (  r4c Cs!y%t||\}}\}}}Wntk r=dSYnXz|tkrl|jdtj|} n|tkrtj|} no|t krt |j|d} nH|t j krtj ||||||fntt j ||dSWd|r|jnXt| ||S)zFind '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'.Nexec)r r"rreadmarshalloadrrDget_frozen_objectrcompilesysmodules load_modulegetattrr!r ) rsymbolr$r#r%rGrHrIrJr:rrrr s$%      "c Cs||jkrdSt|jj|}d}d}d}|}xdt|D]V\}} ||krx|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'. NZad)co_nameslistindexr@ co_consts) r:rWr$Zname_idxZ STORE_NAMEZ STORE_GLOBALZ LOAD_CONSTconstr>r?rrrr s  $javaclirb) __future__rrSrDrOrrrrdistutils.versionrr__all__r r@r r r platform startswithremoverrrrs$"I )))"!