ó
^†êWc           @@  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 d	 e f d
 „  ƒ  YZ d S(   i    (   t   absolute_importN(   t   RequirementSet(   t   RequirementCommand(   t
   cmdoptions(   t
   ensure_dirt   normalize_path(   t   BuildDirectory(   t   check_path_ownert   DownloadCommandc           B@  s2   e  Z d  Z d 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.
    t   downloads%  
      %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> ...s   Download packages.c         O@  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(   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   editablet   requirementst	   build_dirt   no_depst   global_optionst	   no_binaryt   only_binaryt   srct   pret   no_cleant   require_hashest   ost   curdirt   make_option_groupt   non_deprecated_index_groupt   parsert   insert_option_group(   t   selft   argst   kwR   t
   index_opts(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/download.pyR   (   s2    		c   
      C@  s²  t  | _ t j j | j ƒ | _ t | j ƒ | _ t | j ƒ |  j	 | ƒ ]} |  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 t  d | j d | d	 | j d
 | j ƒ } |  j | | | | | |  j d  ƒ | j s>d  S| j | ƒ d j g  | j D] } | j ^ q[ƒ }	 |	 rŒt j d |	 ƒ n  | j s¢| j ƒ  n  Wd  QXWd  QX| S(   NsÝ   The 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.t   deleteR   t   src_dirR   t   ignore_installedt   ignore_dependenciest   sessiont   isolatedR   t    s   Successfully downloaded %s(   t   TrueR,   R    t   patht   abspathR+   R   R   R   t   _build_sessiont   _build_package_finderR   R   t	   cache_dirR   t   loggert   warningt   NoneR   R   R-   t   isolated_modeR   t   populate_requirement_sett   namet   has_requirementst   prepare_filest   joint   successfully_downloadedt   infot   cleanup_files(
   R&   t   optionsR'   R.   t   findert   build_deleteR   t   requirement_sett   reqt
   downloaded(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/download.pyt   runJ   sT    	
					"	(   t   __name__t
   __module__t   __doc__R<   t   usaget   summaryR   RI   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/download.pyR      s   	"(   t
   __future__R    t   loggingR    t   pip.reqR   t   pip.basecommandR   t   pipR   t	   pip.utilsR   R   t   pip.utils.buildR   t   pip.utils.filesystemR   t	   getLoggerRJ   R7   R   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/download.pyt   <module>   s   