
0c@_6                 @   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	 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 d  d
 l m Z e r d  d l m Z d  d l m Z e j e  Z Gd d   d e	  Z d S)    )absolute_importN)
cmdoptions)make_target_python)RequirementCommandwith_cleanup)SUCCESS)get_requirement_tracker)
ensure_dirnormalize_pathwrite_output)TempDirectory)MYPY_CHECK_RUNNING)Values)Listc               @   s:   e  Z d  Z d Z d Z d d   Z e d d    Z d S)DownloadCommandaL  
    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.
    a  
      %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             C   s  |  j  j t j    |  j  j t j    |  j  j t j    |  j  j t j    |  j  j t j    |  j  j t j    |  j  j t j	    |  j  j t j
    |  j  j t j    |  j  j t j    |  j  j t j    |  j  j t j    |  j  j t j    |  j  j t j    |  j  j t j    |  j  j d d d d d d d d d	 t j d
 d t j |  j   t j t j |  j  } |  j j d |  |  j j d |  j   d  S)Nz-dz--destz--destination-dirz--destination-directorydestdownload_dirmetavardirdefaulthelpzDownload packages into <dir>.r   )cmd_opts
add_optionr   constraintsrequirements	build_dirno_depsglobal_options	no_binaryonly_binaryZprefer_binarysrcprerequire_hashesZprogress_barZno_build_isolationZ
use_pep517Zno_use_pep517oscurdirZadd_target_python_optionsmake_option_groupindex_groupparserinsert_option_group)self
index_opts r+   >/tmp/pip-build-jynh7p1z/pip/pip/_internal/commands/download.pyadd_options*   s6    		zDownloadCommand.add_optionsc             C   s  d | _  g  | _ t j |  t | j  | _ t | j  |  j |  } t |  } |  j	 d | d | d |  } | j
 p | j } |  j t    } t | j d | d d d d } |  j | | | |  }	 |  j d	 | d | d
 | d | d | d | j d d  }
 |  j d |
 d | d | d | j  } |  j |  | j |	 d d } d j d d   | j j   D  } | rt d |  t S)NToptionssessiontarget_pythondeletekinddownloadZglobally_managedZtemp_build_dirreq_trackerfinderr   use_user_siteFpreparerZpy_version_infoZcheck_supported_wheels c             S   s"   g  |  ] } | j  r | j  q Sr+   )successfully_downloadedname).0reqr+   r+   r,   
<listcomp>   s   	z'DownloadCommand.run.<locals>.<listcomp>zSuccessfully downloaded %s)ignore_installed	editablesr   Zcheck_dist_restrictionr
   r   r	   Zget_default_sessionr   _build_package_finderno_cleanr   enter_contextr   r   Zget_requirementsZmake_requirement_preparerZmake_resolverpython_versionZtrace_basic_inforesolvejoinr   valuesr   r   )r)   r.   argsr/   r0   r5   build_deleter4   	directoryreqsr7   resolverrequirement_set
downloadedr+   r+   r,   runN   sP    										zDownloadCommand.runN)__name__
__module____qualname____doc__usager-   r   rN   r+   r+   r+   r,   r      s   $r   )
__future__r   loggingr#   Zpip._internal.clir   Zpip._internal.cli.cmdoptionsr   Zpip._internal.cli.req_commandr   r   Zpip._internal.cli.status_codesr   Zpip._internal.req.req_trackerr   Zpip._internal.utils.miscr	   r
   r   Zpip._internal.utils.temp_dirr   Zpip._internal.utils.typingr   optparser   Ztypingr   	getLoggerrO   loggerr   r+   r+   r+   r,   <module>   s   