î
½1kd–1  ã               @   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_dirz˜Directory 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_truezˆUpgrade 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_eggzâInstall 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__© úC/var/www/pythonscrapper/code/venv/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   "