0{Y5@sddlZddlZddlZddlZddlmZmZmZddlm Z ddl m Z m Z m Z mZddlmZddlmZddlmZmZmZddlmZdd lmZGd d d eZdS) N)InstallRequirementRequirementSetparse_requirements)logger) src_prefixvirtualenv_no_globaldistutils_scheme build_prefix)Command) PackageFinder)InstallationError CommandErrorPreviousBuildDirError) cmdoptions)BuildDirectorycsXeZdZdZdZdZdZdZfddZdd 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] ... %prog [options] -r ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...zInstall packages.Fc shtt|j|||j}|jdddddddgdd d d |jtjj|jtjj|jd d ddddddd d|jddddddddddd d|jtj j|jdddddddddt d d|jdddddd d d!|jd"dd#dd d d$|jd%d&dd'dd d d(|jtj j|jd)dd*dd d d+|jd,dd-dd d d.|jtj j|jtj j|jd/dd0dd d d1|jd2dd3dd d d4|jd5dd6ddddd d7|jd8dd9dd:ddd d;|jd<dd dd=dd>d d?|jd@ddAdd=d dB|jtjj|jtjj|jdCdd ddDd dE|jtjjtjtj|j}|jjdF||jjdF|dS)GNz-ez --editabledest editablesactionappenddefaultmetavarzpath/urlhelpzkInstall a project in editable mode (i.e. setuptools "develop mode") from a local project path or a VCS url.z-tz--target target_dirdirzInstall packages into .z-dz --downloadz--download-dirz--download-directory download_dirz`Download packages into instead of installing them, regardless of what's already installed.z--srcz--sourcez --source-dirz--source-directorysrc_dirzDirectory to check out editable projects into. The default in a virtualenv is "/src". The default for global installs is "/src".z-Uz --upgradeupgrade store_truezUpgrade all packages to the newest available version. This process is recursive regardless of whether a dependency is already satisfied.z--force-reinstallforce_reinstallzKWhen upgrading, reinstall all packages even if they are already up-to-date.z-Iz--ignore-installedignore_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_downloadzDEPRECATED. Don't download any packages, just install the ones already downloaded (completes an install run with --no-install).z--user use_user_sitezInstall using the user scheme.z--eggas_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--strip-file-prefixstrip_file_prefixprefixz5Strip given prefix from script paths in wheel RECORD.z --compilecompileTzCompile py files to pycz --no-compile store_falsezDo 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 requirementsmake build_dirdownload_cacherno_depsinstall_optionsglobal_options use_wheel no_use_wheelno_cleanmake_option_group index_groupparserinsert_option_group)selfargskwr- index_opts) __class__//tmp/pip-ok8sy_ze-build/pip/commands/install.pyr,(s     zInstallCommand.__init__cCsRtd|jd|d|jd|jd|jd|jd|jd|jd | 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_urlsr6allow_externalallow_unverifiedallow_all_externalallow_all_prereleasesprocess_dependency_linkssession)r rDr6rFrGrHprerJ)r=optionsrErKrBrBrC_build_package_finders      z$InstallCommand._build_package_finderc"Cs|js$|js$|js$|jr7tjddn|jrUd|_d|_n|jdkr|jsv|jrt|_n|jrt j j |j|_nt j j |j |_ |j pg}|jrtrtdn|jdnd}|jrd|_tj}t j j |j|_t j j|jrtt j j|j rttdn|jd|n|jpg}|jg|j}|jrtjdd j|g}n|jrtjdd n|jrtjdd ||j7}n|j |}|j!|||}|jpN|j } t"|jd | } t#d | d|j d|jd|j$d|j%d|j&d|jd|j'd|j(d|jd|d|d|j) } x'|D]} | j*t+j,| dqWx0|j-D]%} | j*t+j.| d|j/qWxG|j0D]<} x3t1| d|d|d|D]}| j*|qkWqFW| j2si|j3d6}|j4rdt5|dd j|j4}n d!|}tj6|dSzEy |js| j7|d"|j8d#|j8n | j9|j r|j8 r| j:||d$|j;d%|j<d jd&d'| j=D}|r tjd(|q nu|j8sd jd)d'| j>D}|r tjd*|q n0|j8r | j?|j@tjd+|j@nWntAk r+d|_YnXWd|j rc|j sM|jrc| jBd#|j8nXWdQX|jr t j j|jst jC|jntDd,d-|d.}xHt jE|D]7}tFjGt j j||t j j|j|qWtFjH|n| S)/Nz1.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=zIgnoring 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.deleter1rrr2rr%r!ignore_dependenciesr r$rrK pycompile default_vcsfinderrMnamez^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_infobundlerootr'cSsg|]}|jqSrB)rU).0reqrBrBrC 4s z&InstallCommand.run..zSuccessfully installed %scSsg|]}|jqSrB)rU)r[r\rBrBrCr]9s zSuccessfully downloaded %szCreated bundle in %shomepurelib)Ir"r#r1r8r deprecatedrr!r ospathabspathrr4r$rr rrtempfilemkdtempexistsisdirr r5 index_urlextra_index_urlsno_indexnotifyjoin use_mirrorsmirrors_build_sessionrNrrr2rr%rQr r)add_requirementr from_liner from_editablerSr/rhas_requirementsrUrDdictwarn prepare_filesrY locate_filesrr&r'successfully_installedsuccessfully_downloaded create_bundlebundle_filenamer cleanup_filesmakedirsrlistdirshutilmovermtree)r=rMr>r4temp_target_dirr5rErKrT build_deleter1requirement_setrUfilenamer\optsmsg installed downloadedlib_diritemrBrBrCruns              +                  %  "  "         zInstallCommand.run) __name__ __module__ __qualname____doc__rUusagesummaryrYr,rNrrBrB)rArCrs  r)rbsysrerpip.reqrrrpip.logr pip.locationsrrrr pip.basecommandr pip.indexr pip.exceptionsr r rpiprpip.utilrrrBrBrBrCs    "