ó
äq™^c           @@  sÍ   d  d l  m 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 d  d l m Z d  d l m Z m Z m Z d  d	 l m Z e j e ƒ Z d
 e	 f d „  ƒ  YZ d S(   i    (   t   absolute_importN(   t
   cmdoptions(   t   make_target_python(   t   RequirementCommand(   t   RequirementSet(   t   get_requirement_tracker(   t
   ensure_dirt   normalize_patht   write_output(   t   TempDirectoryt   DownloadCommandc           B@  s&   e  Z d  Z d Z d „  Z d „  Z RS(   sL  
    Download packages from:

    - PyPI (and other indexes) using requirement specifiers.
    - VCS project urls.
    - Local project directories.
    - Local or remote source archives.

    pip also supports downloading from "requirements files", which provide
    an easy way to specify a whole environment to be downloaded.
    s  
      %prog [options] <requirement specifier> [package-index-options] ...
      %prog [options] -r <requirements file> [package-index-options] ...
      %prog [options] <vcs project url> ...
      %prog [options] <local project path> ...
      %prog [options] <archive url/path> ...c         O@  sÒ  t  t |  ƒ j | | Ž  |  j } | j t j ƒ  ƒ | j t j ƒ  ƒ | j t j ƒ  ƒ | j t j	 ƒ  ƒ | j t j
 ƒ  ƒ | j t j ƒ  ƒ | j t j ƒ  ƒ | j t j ƒ  ƒ | j t j ƒ  ƒ | j t j ƒ  ƒ | j t j ƒ  ƒ | j t j ƒ  ƒ | j t j ƒ  ƒ | j t j ƒ  ƒ | j t j ƒ  ƒ | j t j ƒ  ƒ | j d d d d d d d d d	 t j d
 d ƒt j | ƒ t j t j |  j ƒ } |  j j d | ƒ |  j j d | ƒ d  S(   Ns   -ds   --dests   --destination-dirs   --destination-directoryt   destt   download_dirt   metavart   dirt   defaultt   helps   Download packages into <dir>.i    (   t   superR
   t   __init__t   cmd_optst
   add_optionR   t   constraintst   requirementst	   build_dirt   no_depst   global_optionst	   no_binaryt   only_binaryt   prefer_binaryt   srct   pret   no_cleant   require_hashest   progress_bart   no_build_isolationt
   use_pep517t   no_use_pep517t   ost   curdirt   add_target_python_optionst   make_option_groupt   index_groupt   parsert   insert_option_group(   t   selft   argst   kwR   t
   index_opts(    (    s<   /tmp/pip-build-aSgKnK/pip/pip/_internal/commands/download.pyR   (   s<    		c         C@  s·  t  | _ g  | _ t j | ƒ t | j ƒ | _ t | j ƒ |  j | ƒ } t	 | ƒ } |  j
 d | d | d | ƒ } | j p† | j } t ƒ  } t | j d | d d ƒú } t ƒ  }	 |  j |	 | | | | d  ƒ |  j d | d | d | d | d	 | d
 | j d t ƒ }
 |  j d |
 d	 | d | d | j ƒ } |  j | ƒ | j |	 ƒ d j g  |	 j D] } | j ^ qcƒ } | r‘t d | ƒ n  | j s§|	 j ƒ  n  Wd  QXWd  QX|	 S(   Nt   optionst   sessiont   target_pythont   deletet   kindt   downloadt   temp_build_dirt   req_trackert   finderR   t   use_user_sitet   preparert   py_version_infot    s   Successfully downloaded %s(   t   Truet   ignore_installedt	   editablesR   t   check_dist_restrictionR   R   R   t   get_default_sessionR   t   _build_package_finderR   R   R   R	   R   t   populate_requirement_sett   Nonet   make_requirement_preparert   Falset   make_resolvert   python_versiont   trace_basic_infot   resolvet   joint   successfully_downloadedt   nameR   t   cleanup_files(   R,   R0   R-   R1   R2   R8   t   build_deleteR7   t	   directoryt   requirement_setR:   t   resolvert   reqt
   downloaded(    (    s<   /tmp/pip-build-aSgKnK/pip/pip/_internal/commands/download.pyt   runP   s\    				 					"	(   t   __name__t
   __module__t   __doc__t   usageR   RU   (    (    (    s<   /tmp/pip-build-aSgKnK/pip/pip/_internal/commands/download.pyR
      s   	((   t
   __future__R    t   loggingR%   t   pip._internal.cliR   t   pip._internal.cli.cmdoptionsR   t   pip._internal.cli.req_commandR   t   pip._internal.reqR   t   pip._internal.req.req_trackerR   t   pip._internal.utils.miscR   R   R   t   pip._internal.utils.temp_dirR	   t	   getLoggerRV   t   loggerR
   (    (    (    s<   /tmp/pip-build-aSgKnK/pip/pip/_internal/commands/download.pyt   <module>   s   