‹“Re#ã@sÇdZddlZddlZddlZddlZddlmZmZmZddl m Z m Z dgZ dd„Z Gd d „d eƒZd d „ZeƒZ[eƒZdd d„ZdS)zG Parser for the environment markers micro-language defined in PEP 508. éNé)Úpython_implementationÚurlparseÚ string_types)Úin_venvÚ parse_markerÚ interpretcCs)t|tƒ s| rdS|ddkS)NFrz'")Ú isinstancer)Úo©r úŠ/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/markers.pyÚ _is_literalsr c@s¸eZdZdZddd„ddd„ddd„d d d„d d d„d dd„ddd„ddd„ddd„ddd„ddd„ddd„i Zdd„ZdS)Ú Evaluatorz; This class is used to evaluate marker expessions. z==cCs ||kS)Nr )ÚxÚyr r r Ú$szEvaluator.z===cCs ||kS)Nr )rrr r r r%sz~=cCs||kp||kS)Nr )rrr r r r&sz!=cCs ||kS)Nr )rrr r r r'súcCs ||kS)Nr )rrr r r r*sz>=cCs||kp||kS)Nr )rrr r r r+sÚandcCs |o |S)Nr )rrr r r r,sÚorcCs |p |S)Nr )rrr r r r-sÚincCs ||kS)Nr )rrr r r r.sznot incCs ||kS)Nr )rrr r r r/sc Cs$t|tƒr[|ddkr2|dd …}q ||krNtd|ƒ‚||}nÅt|tƒspt‚|d}||jkr™td|ƒ‚|d}|d}t|dƒræt|dƒrætd |||fƒ‚|j||ƒ}|j||ƒ}|j|||ƒ}|S) zƒ Evaluate a marker expression returned by the :func:`parse_requirement` function in the specified context. rz'"rzunknown variable: %sÚopzop not implemented: %sÚlhsÚrhszinvalid comparison: %s %s %séÿÿÿÿ) r rÚ SyntaxErrorÚdictÚAssertionErrorÚ operationsÚNotImplementedErrorr Úevaluate) ÚselfÚexprÚcontextÚresultrZelhsZerhsrrr r r r 2s$      zEvaluator.evaluateN)Ú__name__Ú __module__Ú __qualname__Ú__doc__rr r r r r rs            rcCsÝdd„}ttdƒr<|tjjƒ}tjj}n d}d}d|d|dtjd tjƒd tjƒd tj ƒd tj ƒd tjƒdt t ƒƒdtj ƒdtj ƒdd…dtji }|S)NcSsPd|j|j|jf}|j}|dkrL||dt|jƒ7}|S)Nz%s.%s.%sÚfinalr)ÚmajorÚminorÚmicroÚ releaselevelÚstrÚserial)ÚinfoÚversionÚkindr r r Úformat_full_versionNs   z,default_context..format_full_versionÚimplementationÚ0ÚÚimplementation_nameÚimplementation_versionÚos_nameÚplatform_machineÚplatform_python_implementationÚplatform_releaseÚplatform_systemÚplatform_versionZplatform_in_venvÚpython_full_versionÚpython_versionéÚ sys_platform)ÚhasattrÚsysr4r1ÚnameÚosÚplatformÚmachinerÚreleaseÚsystemr.rr@)r3r8r7r$r r r Údefault_contextMs&        rKcCs¯yt|ƒ\}}Wn;tk rS}ztd||fƒ‚WYdd}~XnX|r€|ddkr€td||fƒ‚ttƒ}|rŸ|j|ƒtj||ƒS)zò 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 z)Unable to interpret marker syntax: %s: %sNrú#z*unexpected trailing data in marker: %s: %s)rÚ ExceptionrrÚDEFAULT_CONTEXTÚupdateÚ evaluatorr )ÚmarkerZexecution_contextr"ÚrestÚer#r r r rqs )  )r(rFrDrGÚreÚcompatrrrÚutilrrÚ__all__r ÚobjectrrKrNrPrr r r r Ú s      /