
^V                 @   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 m Z d  d l m Z d  d l m Z e j e  Z Gd	 d
   d
 e  Z d S)    )absolute_importN)RequirementSet)RequirementCommand)
cmdoptions)
ensure_dirnormalize_path)BuildDirectory)check_path_ownerc                   sF   e  Z d  Z d Z d Z d Z d Z   f d d   Z d d   Z   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.
    downloada%  
      %prog [options] <requirement specifier> [package-index-options] ...
      %prog [options] -r <requirements file> [package-index-options] ...
      %prog [options] [-e] <vcs project url> ...
      %prog [options] [-e] <local project path> ...
      %prog [options] <archive url/path> ...zDownload packages.c                sy  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 d d d d d d d d d	 t j d
 d t j t j |  j  } |  j j d |  |  j j d |  d  S)Nz-dz--destz--destination-dirz--destination-directorydestdownload_dirmetavardirdefaulthelpzDownload packages into <dir>.r   )superr
   __init__cmd_opts
add_optionr   constraintseditablerequirements	build_dirno_depsglobal_options	no_binaryonly_binarysrcpreno_cleanrequire_hashesoscurdirmake_option_groupnon_deprecated_index_groupparserinsert_option_group)selfargskwr   
index_opts)	__class__ 4/tmp/pip-build-9m6vxulb/pip/pip/commands/download.pyr   (   s2    		zDownloadCommand.__init__c       	      C   s  d | _  t j j | j  | _ t | j  | _ t | j  |  j |  T} |  j	 | |  } | j
 ps | j } | j r t | j  r t j d | j  d  | _ n  t | j d |  } t d | d | j d | j d d d | j d	 | d
 | j d | j  } |  j | | | | | |  j d   | j s>d  S| j |  d j d d   | j D  } | rt j d |  n  | j
 s| j   n  Wd  QXWd  QX| S)NTzThe directory '%s' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.deleter   src_dirr   ignore_installedignore_dependenciessessionisolatedr!    c             S   s   g  |  ] } | j   q Sr-   )name).0reqr-   r-   r.   
<listcomp>}   s   	 z'DownloadCommand.run.<locals>.<listcomp>zSuccessfully downloaded %s)r1   r"   pathabspathr0   r   r   r   _build_session_build_package_finderr    r   	cache_dirr	   loggerwarningr   r   r2   isolated_moder!   populate_requirement_setr6   has_requirementsprepare_filesjoinsuccessfully_downloadedinfocleanup_files)	r(   optionsr)   r3   finderbuild_deleter   requirement_set
downloadedr-   r-   r.   runJ   sT    	
						zDownloadCommand.run)	__name__
__module____qualname____doc__r6   usagesummaryr   rN   r-   r-   )r,   r.   r
      s   "r
   )
__future__r   loggingr"   pip.reqr   pip.basecommandr   pipr   	pip.utilsr   r   pip.utils.buildr   pip.utils.filesystemr	   	getLoggerrO   r?   r
   r-   r-   r-   r.   <module>   s   