ó
÷Å÷Xc           @` su  d  d l  m Z m Z m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l m	 Z	 m
 Z
 m Z m Z d  d l m Z m Z m Z m Z d  d l m Z d d l m Z d d l m Z m Z d	 d
 d d d g Z d	 e f d „  ƒ  YZ d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ  d e f d „  ƒ  YZ! e d ƒ e d ƒ Be d ƒ Be d ƒ Be d ƒ Be d ƒ Be d ƒ Be d  ƒ Be d! ƒ Be d" ƒ Be d# ƒ Be d$ ƒ Be d% ƒ Be d& ƒ Be d' ƒ Be d( ƒ Be d) ƒ Be d* ƒ BZ" i d# d$ 6d" d% 6d d& 6d d' 6d d( 6d d) 6Z# e" j$ d+ „  ƒ e d, ƒ e d- ƒ Be d. ƒ Be d/ ƒ Be d0 ƒ Be d1 ƒ Be d2 ƒ Be d3 ƒ BZ% e% e d4 ƒ Be d5 ƒ BZ& e& j$ d6 „  ƒ e d7 ƒ e d8 ƒ BZ' e' j$ d9 „  ƒ e d: ƒ e d; ƒ BZ( e" e' BZ) e e) e& e) ƒ Z* e* j$ d< „  ƒ e d= ƒ j+ ƒ  Z, e d> ƒ j+ ƒ  Z- e ƒ  Z. e* e e, e. e- ƒ BZ/ e. e/ e e( e. ƒ >e e. e Z0 d? „  Z1 e2 d@ „ Z3 i dA „  d5 6dB „  d4 6e j4 d3 6e j5 d/ 6e j6 d- 6e j7 d0 6e j8 d. 6e j9 d2 6Z: dC „  Z; e ƒ  Z< dD „  Z= dE „  Z> dF „  Z? dG „  Z@ d e f dH „  ƒ  YZA d S(I   i    (   t   absolute_importt   divisiont   print_functionN(   t   ParseExceptiont   ParseResultst   stringStartt	   stringEnd(   t
   ZeroOrMoret   Groupt   Forwardt   QuotedString(   t   Literali   (   t   string_types(   t	   Specifiert   InvalidSpecifiert   InvalidMarkert   UndefinedComparisont   UndefinedEnvironmentNamet   Markert   default_environmentc           B` s   e  Z d  Z RS(   sE   
    An invalid marker was found, users should refer to PEP 508.
    (   t   __name__t
   __module__t   __doc__(    (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR      s   c           B` s   e  Z d  Z RS(   sP   
    An invalid operation was attempted on a value that doesn't support it.
    (   R   R   R   (    (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR      s   c           B` s   e  Z d  Z RS(   s\   
    A name was attempted to be used that does not exist inside of the
    environment.
    (   R   R   R   (    (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR   %   s   t   Nodec           B` s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C` s   | |  _  d  S(   N(   t   value(   t   selfR   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyt   __init__.   s    c         C` s   t  |  j ƒ S(   N(   t   strR   (   R   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyt   __str__1   s    c         C` s   d j  |  j j t |  ƒ ƒ S(   Ns   <{0}({1!r})>(   t   formatt	   __class__R   R   (   R   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyt   __repr__4   s    c         C` s
   t  ‚ d  S(   N(   t   NotImplementedError(   R   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyt	   serialize7   s    (   R   R   R   R   R   R!   (    (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR   ,   s   			t   Variablec           B` s   e  Z d  „  Z RS(   c         C` s
   t  |  ƒ S(   N(   R   (   R   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR!   =   s    (   R   R   R!   (    (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR"   ;   s   t   Valuec           B` s   e  Z d  „  Z RS(   c         C` s   d j  |  ƒ S(   Ns   "{0}"(   R   (   R   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR!   C   s    (   R   R   R!   (    (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR#   A   s   t   Opc           B` s   e  Z d  „  Z RS(   c         C` s
   t  |  ƒ S(   N(   R   (   R   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR!   I   s    (   R   R   R!   (    (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR$   G   s   t   implementation_versiont   platform_python_implementationt   implementation_namet   python_full_versiont   platform_releaset   platform_versiont   platform_machinet   platform_systemt   python_versiont   sys_platformt   os_names   os.names   sys.platforms   platform.versions   platform.machines   platform.python_implementationt   python_implementationt   extrac         C` s   t  t j | d | d ƒ ƒ S(   Ni    (   R"   t   ALIASESt   get(   t   st   lt   t(    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyt   <lambda>i   s    s   ===s   ==s   >=s   <=s   !=s   ~=t   >t   <s   not int   inc         C` s   t  | d ƒ S(   Ni    (   R$   (   R4   R5   R6   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR7   w   s    t   't   "c         C` s   t  | d ƒ S(   Ni    (   R#   (   R4   R5   R6   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR7   z   s    t   andt   orc         C` s   t  | d ƒ S(   Ni    (   t   tuple(   R4   R5   R6   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR7      s    t   (t   )c         C` s4   t  |  t ƒ r, g  |  D] } t | ƒ ^ q S|  Sd  S(   N(   t
   isinstanceR   t   _coerce_parse_result(   t   resultst   i(    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyRC      s    c         C` sí   t  |  t t t f ƒ s t ‚ t  |  t ƒ rf t |  ƒ d k rf t  |  d t t f ƒ rf t |  d ƒ St  |  t ƒ r° d „  |  Dƒ } | r˜ d j | ƒ Sd d j | ƒ d Sn9 t  |  t ƒ rå d j g  |  D] } | j ƒ  ^ qÌ ƒ S|  Sd  S(   Ni   i    c         s` s!   |  ] } t  | d  t ƒVq d S(   t   firstN(   t   _format_markert   False(   t   .0t   m(    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pys	   <genexpr>    s    t    R@   RA   (	   RB   t   listR?   R   t   AssertionErrort   lenRG   t   joinR!   (   t   markerRF   t   innerRJ   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyRG   ”   s    !&c         C` s
   |  | k S(   N(    (   t   lhst   rhs(    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR7   ¬   s    c         C` s
   |  | k S(   N(    (   RR   RS   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR7   ­   s    c         C` s’   y% t  d j | j ƒ  | g ƒ ƒ } Wn t k
 r8 n X| j |  ƒ St j | j ƒ  ƒ } | d  k r… t d j	 | |  | ƒ ƒ ‚ n  | |  | ƒ S(   Nt    s#   Undefined {0!r} on {1!r} and {2!r}.(
   R   RO   R!   R   t   containst
   _operatorsR3   t   NoneR   R   (   RR   t   opRS   t   spect   oper(    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyt   _eval_op·   s    %c         C` s:   |  j  | t ƒ } | t k r6 t d j | ƒ ƒ ‚ n  | S(   Ns/   {0!r} does not exist in evaluation environment.(   R3   t
   _undefinedR   R   (   t   environmentt   nameR   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyt   _get_envË   s
    c   	      C` s,  g  g } x|  D]} t  | t t t f ƒ s4 t ‚ t  | t ƒ r` | d j t | | ƒ ƒ q t  | t ƒ ræ | \ } } } t  | t ƒ r« t | | j	 ƒ } | j	 } n | j	 } t | | j	 ƒ } | d j t
 | | | ƒ ƒ q | d k sø t ‚ | d k r | j g  ƒ q q Wt d „  | Dƒ ƒ S(   NiÿÿÿÿR=   R>   c         s` s   |  ] } t  | ƒ Vq d  S(   N(   t   all(   RI   t   item(    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pys	   <genexpr>î   s    (   s   ands   or(   RB   RL   R?   R   RM   t   appendt   _evaluate_markersR"   R_   R   R[   t   any(	   t   markersR]   t   groupsRP   RR   RX   RS   t	   lhs_valuet	   rhs_value(    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyRc   Ö   s"    		 c         C` sF   d j  |  ƒ } |  j } | d k rB | | d t |  j ƒ 7} n  | S(   Ns   {0.major}.{0.minor}.{0.micro}t   finali    (   R   t   releaselevelR   t   serial(   t   infot   versiont   kind(    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyt   format_full_versionñ   s
    	c          C` sÁ   t  t d ƒ r0 t t j j ƒ }  t j j } n d }  d } i | d 6|  d 6t j d 6t j ƒ  d 6t j	 ƒ  d 6t j
 ƒ  d	 6t j ƒ  d
 6t j ƒ  d 6t j ƒ  d 6t j ƒ  d  d 6t j d 6S(   Nt   implementationt   0RT   R'   R%   R/   R+   R)   R,   R*   R(   R&   i   R-   R.   (   t   hasattrt   sysRo   Rp   Rm   R^   t   ost   platformt   machinet   releaset   systemR-   R0   (   t   iverR'   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR   ù   s"    
c           B` s/   e  Z d  „  Z d „  Z d „  Z d d „ Z RS(   c         C` se   y t  t j | ƒ ƒ |  _ WnB t k
 r` } d j | | | j | j d !ƒ } t | ƒ ‚ n Xd  S(   Ns+   Invalid marker: {0!r}, parse error at {1!r}i   (   RC   t   MARKERt   parseStringt   _markersR   R   t   locR   (   R   RP   t   et   err_str(    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR     s    c         C` s   t  |  j ƒ S(   N(   RG   R|   (   R   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR     s    c         C` s   d j  t |  ƒ ƒ S(   Ns   <Marker({0!r})>(   R   R   (   R   (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR     s    c         C` s5   t  ƒ  } | d k	 r% | j | ƒ n  t |  j | ƒ S(   s$  Evaluate a marker.

        Return the boolean from evaluating the given marker against the
        environment. environment is an optional argument to override all or
        part of the determined environment.

        The environment is determined from the current Python process.
        N(   R   RW   t   updateRc   R|   (   R   R]   t   current_environment(    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyt   evaluate   s    		N(   R   R   R   R   R   RW   R‚   (    (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyR     s   			(B   t
   __future__R    R   R   t   operatorRt   Ru   Rs   t	   pyparsingR   R   R   R   R   R   R	   R
   R   t   Lt   _compatR   t
   specifiersR   R   t   __all__t
   ValueErrorR   R   R   t   objectR   R"   R#   R$   t   VARIABLER2   t   setParseActiont   VERSION_CMPt	   MARKER_OPt   MARKER_VALUEt   BOOLOPt
   MARKER_VARt   MARKER_ITEMt   suppresst   LPARENt   RPARENt   MARKER_EXPRt   MARKER_ATOMRz   RC   t   TrueRG   t   ltt   let   eqt   net   get   gtRV   R[   R\   R_   Rc   Ro   R   R   (    (    (    s4   /tmp/pip-build-F2t1Dv/packaging/packaging/markers.pyt   <module>   s|   ""	©
	E
		






						