abc@sdZddlZddlZddlZddlZddlmZmZddlm Z dgZ de fdYZ dd ZdS( sEParser for the environment markers micro-language defined in PEP 345.iNi(tpython_implementationt string_types(tin_venvt interprett EvaluatorcBs^eZdZi dd6dd6dd6dd6d d 6d d 6d d6dd6dd6Zi ejd6dejd d6ejjdddd6e j d6e e d6ej d6ejd6ejd6ed 6Zd,d!Zd"Zd#Zd,d$Zd%Zd&Zd'Zd(Zd)Zd*Zd+ZRS(-s5 A limited evaluator for Python expressions. cCs ||kS(N((txty((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyttteqcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtgtcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtgtecCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtincCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtltcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRRtltecCs| S(N((R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyR RtnotcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyR!RtnoteqcCs ||kS(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyR"Rtnotint sys_platforms%s.%sitpython_versiont iitpython_full_versiontos_nametplatform_in_venvtplatform_releasetplatform_versiontplatform_machinetplatform_python_implementationcCs|p i|_d|_dS(su Initialise an instance. :param context: If specified, names are looked up in this mapping. N(tcontexttNonetsource(tselfR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt__init__3scCsHd}d|j|||!}||t|jkrD|d7}n|S(sH Get the part of the source which is causing a problem. i s%rs...(Rtlen(Rtoffsett fragment_lents((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt get_fragment<s  cCst|d|dS(s@ Get a handler for the specified AST node type. sdo_%sN(tgetattrR(Rt node_type((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt get_handlerFscCst|tr||_idd6}|r8||dR%R3R/(tlhsnodetrhsnodeR@R$(R4R(s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt sanity_checks $ sunsupported operation: %r( tleftR8RLtziptopst comparatorsR0R1R2t operatorsR/( RR4RPRNtlhsRBREROtrhs((R4Rs?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt do_compares  "  cCs|j|jS(N(R8tbody(RR4((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyt do_expressionscCs|t}|j|jkr1t}|j|j}n+|j|jkr\t}|j|j}n|sxtd|jn|S(Nsinvalid expression: %s(R>R:RRLR?R/(RR4R@RB((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pytdo_namescCs|jS(N(R$(RR4((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pytdo_strsN(R1t __module__t__doc__RUtsystplatformt version_infotversiontsplittostnametstrRtreleasetmachineRR?RR R%R(R8R<RCRKRXRZR[R\(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRs@                      cCst|j|jS(s Interpret a marker and return a result depending on environment. :param marker: The marker to interpret. :type marker: str :param execution_context: The context used for name lookup. :type execution_context: mapping (RR8tstrip(tmarkertexecution_context((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyRs (R^R-RdR_R`tcompatRRtutilRt__all__tobjectRRR(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/markers.pyts