ó
“àfac        
   @@  sÆ  d  d l  m 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 m Z d  d l m Z e rp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% m& Z& d  d l' m( Z( e# e! e$ e) e& f e* e  e) f Z+ n  e j, e- ƒ Z. d d e0 e0 d e0 d e0 d d „	 Z1 d „  Z2 d e3 f d „  ƒ  YZ4 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%   direct_url_as_pep440_direct_referencet   dist_get_direct_url(   t   dist_is_editablet   get_installed_distributions(   t   MYPY_CHECK_RUNNING(	   t	   Containert   Dictt   Iterablet   Iteratort   Listt   Optionalt   Sett   Tuplet   Union(   t   Distributiont   Requirement(   t
   WheelCachec	         c@  s  | p	 g  } x | D] }	 d j  |	 ƒ Vq Wi  }
 xŠ t d | d d" d | d | ƒ D]g } y t j | ƒ } Wn) t k
 r— } t j d | | ƒ qS n X| r­ | j r­ qS n  | |
 | j <qS W|  rCt	 ƒ  } t
 j t ƒ } xÿ|  D]÷} t | ƒ ã} xÙ| D]Ñ} | j ƒ  s6| j ƒ  j d ƒ s6| j d# ƒ ri| 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 | ƒ} n$ t t j d | ƒ j ƒ  d | ƒ} | j s3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 {}t
   local_onlyt   skipt	   user_onlyt   pathss6   Could not generate requirement for distribution %r: %st   #s   -rs   --requirements   -fs   --find-linkss   -is   --index-urls   --pres   --trusted-hosts   --process-dependency-linkss   --extra-index-urls   --use-features   -es
   --editablei   t   =t   isolatedt    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-install-YjPQSb/pip/pip/_internal/operations/freeze.pyt   <lambda>¯   R!   (    (   s   -rs   --requirements   -fs   --find-linkss   -is   --index-urls   --pres   --trusted-hosts   --process-dependency-linkss   --extra-index-urls   --use-feature("   t   formatR   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   R    t   wheel_cachet   exclude_editableR   t   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-install-YjPQSb/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   RemoteNotFoundErrort   vcss1   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   t   Nonet   Falset   ost   patht   normcaset   abspatht   locationt   pip._internal.vcsRT   RU   t   get_backend_for_dirt   as_requirementR*   t   debugR'   t   Truet   get_src_requirementt   project_namet   typet   __name__R   R+   R#   R   (   RG   R\   RT   RU   t   vcs_backendRH   t   commentsRI   (    (    s>   /tmp/pip-install-YjPQSb/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-   RH   R,   Rg   (   t   selfR#   RH   R,   Rg   (    (    s>   /tmp/pip-install-YjPQSb/pip/pip/_internal/operations/freeze.pyt   __init__ó   s
    			c         C@  sŒ   t  | ƒ \ } } } | d  k rX | rX t | ƒ } | rX t | | j ƒ } g  } qX n  | d  k rs | j ƒ  } n  |  | j | | d | ƒS(   NRg   (   Rh   RV   R
   R	   Rc   R_   (   t   clsRG   RH   R,   Rg   t
   direct_url(    (    s>   /tmp/pip-install-YjPQSb/pip/pip/_internal/operations/freeze.pyR)   û   s    c         C@  sK   |  j  } |  j r$ d j | ƒ } n  d j t |  j ƒ t | ƒ g ƒ d S(   Ns   -e {}s   
(   RH   R,   R'   R>   R1   Rg   R<   (   Ri   RH   (    (    s>   /tmp/pip-install-YjPQSb/pip/pip/_internal/operations/freeze.pyt   __str__  s    		(    (   Re   t
   __module__Rj   t   classmethodR)   Rm   (    (    (    s>   /tmp/pip-install-YjPQSb/pip/pip/_internal/operations/freeze.pyR(   ò   s   (    (5   t
   __future__R    R/   t   loggingRX   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.direct_url_helpersR	   R
   t   pip._internal.utils.miscR   R   t   pip._internal.utils.typingR   t   typingR   R   R   R   R   R   R   R   R   R   R   t   pip._internal.cacheR   R<   t   boolt   RequirementInfot	   getLoggerRe   R*   RV   RW   RS   Rh   t   objectR(   (    (    (    s>   /tmp/pip-install-YjPQSb/pip/pip/_internal/operations/freeze.pyt   <module>   s:   @(|	>