ó
äq™^c           @@  s¿  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l m Z d  d l m	 Z	 d  d l
 m Z d  d l m Z m Z d  d l m Z m Z d  d l m Z d  d	 l m Z m Z d  d
 l m Z e rfd  d l m Z m Z m Z m Z m Z m Z m  Z  m! Z! m" Z" d  d l# m$ Z$ d  d l
 m% Z% m& Z& e  e e" e' e& f e( e e' f Z) n  e j* e+ ƒ Z, d d d d d d e. d e. d d „
 Z/ d „  Z0 d e1 f d „  ƒ  YZ2 d S(   i    (   t   absolute_importN(   t   six(   t   canonicalize_name(   t   RequirementParseError(   t
   BadCommandt   InstallationError(   t   install_req_from_editablet   install_req_from_line(   t
   COMMENT_RE(   t   dist_is_editablet   get_installed_distributions(   t   MYPY_CHECK_RUNNING(	   t   Iteratort   Optionalt   Listt	   Containert   Sett   Dictt   Tuplet   Iterablet   Union(   t
   WheelCache(   t   Distributiont   Requirementc
         c@  sÊ  | p	 g  } d  }
 | r- t j | ƒ j }
 n  x | D] } d | Vq4 Wi  } xŠ t d | d d$ d | d | ƒ D]g } y t j | ƒ } Wn) t k
 r³ } t j	 d | | ƒ qo n X| rÉ | j
 rÉ qo n  | | | j <qo W|  r}t ƒ  } t j t ƒ } x|  D]} t | ƒ } x÷| D]ï} | j ƒ  sd| j ƒ  j d ƒ sd|
 rU|
 | ƒ sd| j d% ƒ r—| j ƒ  } | | k r| j | ƒ | Vqqn  | j d ƒ sµ| j d ƒ r| j d ƒ r×| d j ƒ  } n | t d ƒ j ƒ  j d ƒ } t | d | d | ƒ} n* t t j d | ƒ j ƒ  d | d | ƒ} | j smt j d | | j ƒ  ƒ t j d ƒ qt | j ƒ } | | k rÚ| | j sÃt j	 d | t j d | ƒ j ƒ  | j ƒ q
| | j j | ƒ qt | | ƒ j ƒ  V| | =| | j j | ƒ qWWd  QXqÿ WxZ t  j! | ƒ D]I \ } } t | ƒ d k r(t j	 d | d  j" t# t | ƒ ƒ ƒ ƒ q(q(Wd! Vn  xF t# | j$ ƒ  d" d# „  ƒD]) } | j |	 k r™t | ƒ j ƒ  Vq™q™Wd  S(&   Ns   -f %st
   local_onlyt   skipt	   user_onlyt   pathss6   Could not generate requirement for distribution %r: %st   #s   -rs   --requirements   -Zs   --always-unzips   -fs   --find-linkss   -is   --index-urls   --pres   --trusted-hosts   --process-dependency-linkss   --extra-index-urls   -es
   --editablei   t   =t   isolatedt   wheel_cachet    sW   Skipping line in requirement file [%s] because it's not clear what it would install: %ss9     (add #egg=PackageName to the URL to avoid this warning)sB   Requirement file [%s] contains %s, but package %r is not installedi   s+   Requirement %s included multiple times [%s]s   , s7   ## The following requirements were added by pip freeze:t   keyc         S@  s   |  j  j ƒ  S(   N(   t   namet   lower(   t   x(    (    s<   /tmp/pip-build-aSgKnK/pip/pip/_internal/operations/freeze.pyt   <lambda>°   s    (    (   s   -rs   --requirements   -Zs   --always-unzips   -fs   --find-linkss   -is   --index-urls   --pres   --trusted-hosts   --process-dependency-linkss   --extra-index-url(%   t   Nonet   ret   compilet   searchR
   t   FrozenRequirementt	   from_distR   t   loggert   warningt   editablet   canonical_namet   sett   collectionst   defaultdictt   listt   opent   stript
   startswitht   rstript   addt   lent   lstripR   R   R   t   subR"   t   infoR   t   appendt   strR   t	   iteritemst   joint   sortedt   values(   t   requirementt
   find_linksR   R   R   t
   skip_regexR   R   t   exclude_editableR   t
   skip_matcht   linkt   installationst   distt   reqt   exct   emitted_optionst	   req_filest   req_file_patht   req_filet   linet   line_reqt   line_req_canonical_nameR"   t   filest   installation(    (    s<   /tmp/pip-build-aSgKnK/pip/pip/_internal/operations/freeze.pyt   freeze+   sª    
	       			
"	&c         C@  s›  t  |  ƒ s d
 t g  f St j j t j j |  j ƒ ƒ } d d l m	 } m
 } | j | ƒ } | d
 k r© |  j ƒ  } t j d | | ƒ d j | ƒ g } | t | f Sy | j | |  j ƒ } Wn— | k
 r	|  j ƒ  } d j t | ƒ j | ƒ g } | t | f St k
 r9t j d | | j ƒ d
 t g  f St k
 r[} t j d | ƒ n X| d
 k	 ru| t g  f St j d | ƒ d	 g } d
 t | f S(   sk   
    Compute and return values (req, editable, comments) for use in
    FrozenRequirement.from_dist().
    i    (   t   vcst   RemoteNotFoundErrors1   No VCS found for editable requirement "%s" in: %rs/   # Editable install with no version control ({})s)   # Editable {} install with no remote ({})sP   cannot determine version of editable source in %s (%s command not found in path)sY   Error when trying to get requirement for VCS system %s, falling back to uneditable formats-   Could not determine repository location of %ss-   ## !! Could not determine repository locationN(   R	   R&   t   Falset   ost   patht   normcaset   abspatht   locationt   pip._internal.vcsRW   RX   t   get_backend_for_dirt   as_requirementR,   t   debugt   formatt   Truet   get_src_requirementt   project_namet   typet   __name__R   R-   R"   R   (   RJ   R^   RW   RX   t   vcs_backendRK   t   commentsRL   (    (    s<   /tmp/pip-build-aSgKnK/pip/pip/_internal/operations/freeze.pyt   get_requirement_infoµ   sF    !

	R*   c           B@  s,   e  Z d d  „ Z e d „  ƒ Z d „  Z RS(   c         C@  s7   | |  _  t | ƒ |  _ | |  _ | |  _ | |  _ d  S(   N(   R"   R   R/   RK   R.   Rj   (   t   selfR"   RK   R.   Rj   (    (    s<   /tmp/pip-build-aSgKnK/pip/pip/_internal/operations/freeze.pyt   __init__ô   s
    			c         C@  sI   t  | ƒ \ } } } | d  k r0 | j ƒ  } n  |  | j | | d | ƒS(   NRj   (   Rk   R&   Ra   Rf   (   t   clsRJ   RK   R.   Rj   (    (    s<   /tmp/pip-build-aSgKnK/pip/pip/_internal/operations/freeze.pyR+   ü   s    c         C@  sF   |  j  } |  j r d | } n  d j t |  j ƒ t | ƒ g ƒ d S(   Ns   -e %ss   
(   RK   R.   R@   R3   Rj   R>   (   Rl   RK   (    (    s<   /tmp/pip-build-aSgKnK/pip/pip/_internal/operations/freeze.pyt   __str__  s    		(    (   Rh   t
   __module__Rm   t   classmethodR+   Ro   (    (    (    s<   /tmp/pip-build-aSgKnK/pip/pip/_internal/operations/freeze.pyR*   ó   s   	(    (3   t
   __future__R    R1   t   loggingRZ   R'   t   pip._vendorR   t   pip._vendor.packaging.utilsR   t   pip._vendor.pkg_resourcesR   t   pip._internal.exceptionsR   R   t   pip._internal.req.constructorsR   R   t   pip._internal.req.req_fileR   t   pip._internal.utils.miscR	   R
   t   pip._internal.utils.typingR   t   typingR   R   R   R   R   R   R   R   R   t   pip._internal.cacheR   R   R   R>   t   boolt   RequirementInfot	   getLoggerRh   R,   R&   RY   RV   Rk   t   objectR*   (    (    (    s<   /tmp/pip-build-aSgKnK/pip/pip/_internal/operations/freeze.pyt   <module>   s<   @(€	>