
 X1                 @   s   d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l m Z m Z m Z d  d l m	 Z	 d  d l
 m Z m Z 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 Gd	 d
   d
 e  Z d S)    N)InstallRequirementRequirementSetparse_requirements)logger)
src_prefixvirtualenv_no_globaldistutils_schemebuild_prefix)Command)PackageFinder)InstallationErrorCommandErrorPreviousBuildDirError)
cmdoptionsc                   sX   e  Z d  Z d Z d Z d Z d Z d Z   f d d   Z d d	   Z	 d
 d   Z
   S)InstallCommandaI  
    Install packages from:

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

    pip also supports installing from "requirements files", which provide
    an easy way to specify a whole environment to be installed.
    installz
      %prog [options] <requirement specifier> ...
      %prog [options] -r <requirements file> ...
      %prog [options] [-e] <vcs project url> ...
      %prog [options] [-e] <local project path> ...
      %prog [options] <archive url/path> ...zInstall packages.Fc                sC  t  t |   j | |   |  j } | j d d d d d d d g  d d	 d
 d | j t j j    | j t j j    | j d d d d d d d d  d
 d | j d d d d d d d d d d  d
 d | j t j	 j    | j d d d d d d d d d t
 d
 d | j d d d d d d  d
 d! | j d" d d# d d  d
 d$ | j d% d& d d' d d  d
 d( | j t j j    | j d) d d* d d  d
 d+ | j d, d d- d d  d
 d. | j t j j    | j t j j    | j d/ d d0 d d  d
 d1 | j d2 d d3 d d  d
 d4 | j d5 d d6 d d d d  d
 d7 | j d8 d d  d d9 d d: d
 d; | j d< d d= d d9 d
 d> | j t j j    | j t j j    | j d? d d  d d@ d
 dA | j t j j    t j t j |  j  } |  j j dB |  |  j j dB |  d  S)CNz-ez
--editabledest	editablesactionappenddefaultmetavarzpath/urlhelpzkInstall a project in editable mode (i.e. setuptools "develop mode") from a local project path or a VCS url.z-tz--target
target_dirdirzInstall packages into <dir>.z-dz
--downloadz--download-dirz--download-directorydownload_dirz`Download packages into <dir> instead of installing them, regardless of what's already installed.z--srcz--sourcez--source-dirz--source-directorysrc_dirzDirectory to check out editable projects into. The default in a virtualenv is "<venv path>/src". The default for global installs is "<current dir>/src".z-Uz	--upgradeupgrade
store_truezUpgrade all packages to the newest available version. This process is recursive regardless of whether a dependency is already satisfied.z--force-reinstallforce_reinstallzKWhen upgrading, reinstall all packages even if they are already up-to-date.z-Iz--ignore-installedignore_installedz5Ignore the installed packages (reinstalling instead).z--no-install
no_installzNDEPRECATED. Download and unpack all packages, but don't actually install them.z--no-downloadno_downloadzDEPRECATED. Don't download any packages, just install the ones already downloaded (completes an install run with --no-install).z--useruse_user_sitezInstall using the user scheme.z--eggas_eggzInstall packages as eggs, not 'flat', like pip normally does. This option is not about installing *from* eggs. (WARNING: Because this option overrides pip's normal install logic, requirements files may not behave as expected.)z--root	root_pathz=Install everything relative to this alternate root directory.z	--compilecompileTzCompile py files to pycz--no-compilestore_falsezDo not compile py files to pycz--preFzYInclude pre-release and development versions. By default, pip only finds stable versions.r   )superr   __init__cmd_opts
add_optionr   requirementsmake	build_dirdownload_cacher   no_depsinstall_optionsglobal_options	use_wheelno_use_wheelno_cleanmake_option_groupindex_groupparserinsert_option_group)selfargskwr*   
index_opts)	__class__ ?/home/ubuntu/projects/ifolica/build/pip/pip/commands/install.pyr)   '   s    					zInstallCommand.__init__c             C   sR   t  d | j d | d | j d | j d | j d | j d | j d | j d	 |  	S)
z
        Create a package finder appropriate to this install command.
        This method is meant to be overridden by subclasses, not
        called directly.
        
find_links
index_urlsr3   allow_externalallow_unverifiedallow_all_externalallow_all_prereleasesprocess_dependency_linkssession)r   rA   r3   rC   rD   rE   prerG   )r:   optionsrB   rH   r?   r?   r@   _build_package_finder   s    						z$InstallCommand._build_package_finderc             C   s  | j  s* | j s* | j t k s* | j r= t j d d  n  | j r[ d | _  d | _ n  t	 j
 j | j  | _ t	 j
 j | j  | _ | j p g  } | j r t   r t d   n  | j d  n  d  } | j rUd | _ t j   } t	 j
 j | j  | _ t	 j
 j | j  rAt	 j
 j | j  rAt d   n  | j d |  n  | j pag  } | j g | j } | j rt j d d	 j |   g  } n  | j rt j d d
  n  | j rt j d d  | | j 7} n  |  j  |  } |  j! | | |  } t" d | j d | j d | j d | j# d | j$ d | j% d | j d | j& d | j' d | j d | d | d | j(  }	 x' | D] }
 |	 j) t* j+ |
 d    qWx0 | j, D]% }
 |	 j) t* j- |
 d | j.  qWxG | j/ D]< } x3 t0 | d | d | d | D] } |	 j) |  qWqW|	 j1 si |  j2 d 6} | j3 rrd t4 | d d j | j3  } n
 d  | } t j5 |  d  Sz<y| j s|	 j6 | d! |  j7 d" |  j7 n
 |	 j8   | j  r1|  j7 r1|	 j9 | | d# | j: d j d$ d%   |	 j; D  } | rt j d& |  qnu |  j7 svd j d' d%   |	 j< D  } | rt j d( |  qn0 |  j7 r|	 j= |  j>  t j d) |  j>  n  Wn t? k
 rd | _   Yn XWd  | j r| j  s| j r|	 j@ d" |  j7  n  X| j rt	 j
 j | j  s1t	 jA | j  n  tB d* d+ | d, } xH t	 jC |  D]7 } tD jE t	 j
 j | |  t	 j
 j | j |   qWWtD jF |  n  |	 S)-Nz1.7z~DEPRECATION: --no-install, --no-download, --build, and --no-clean are deprecated.  See https://github.com/pypa/pip/issues/906.TzZCan not perform a '--user' install. User site-packages are not visible in this virtualenv.z--userz=Target path exists but is not a directory, will not continue.z--home=zIgnoring indexes: %s,z--use-mirrors has been deprecated and will be removed in the future. Explicit uses of --index-url and/or --extra-index-url is suggested.z--mirrors has been deprecated and will be removed in  the future. Explicit uses of --index-url and/or --extra-index-url is suggested.r.   r   r   r/   r   r$   r    ignore_dependenciesr   r#   r   rH   	pycompiledefault_vcsfinderrJ   namez^You must give at least one requirement to %(name)s (maybe you meant "pip %(name)s %(links)s"?)links zLYou must give at least one requirement to %(name)s (see "pip help %(name)s")force_root_egg_infobundlerootc             S   s   g  |  ] } | j   q Sr?   )rQ   ).0reqr?   r?   r@   
<listcomp>  s   	 z&InstallCommand.run.<locals>.<listcomp>zSuccessfully installed %sc             S   s   g  |  ] } | j   q Sr?   )rQ   )rW   rX   r?   r?   r@   rY   !  s   	 zSuccessfully downloaded %szCreated bundle in %s homepurelib)Gr!   r"   r.   r	   r5   r   
deprecatedr   r    ospathabspathr   r1   r#   r   r   r   r   tempfilemkdtempexistsisdirr   r2   	index_urlextra_index_urlsno_indexnotifyjoinuse_mirrorsmirrors_build_sessionrK   r   r/   r   r$   rM   r   r&   add_requirementr   	from_liner   from_editablerO   r,   r   has_requirementsrQ   rA   dictwarnprepare_filesrU   locate_filesr   r%   successfully_installedsuccessfully_downloadedcreate_bundlebundle_filenamer   cleanup_filesmakedirsr   listdirshutilmovermtree)r:   rJ   r;   r1   temp_target_dirr2   rB   rH   rP   requirement_setrQ   filenamerX   optsmsg	installed
downloadedlib_diritemr?   r?   r@   run   s    									+				
												%		"	"
				zInstallCommand.run)__name__
__module____qualname____doc__rQ   usagesummaryrU   r)   rK   r   r?   r?   )r>   r@   r      s   r   )r^   sysra   r|   pip.reqr   r   r   pip.logr   pip.locationsr   r   r   r	   pip.basecommandr
   	pip.indexr   pip.exceptionsr   r   r   pipr   r   r?   r?   r?   r@   <module>   s   "