3 ig(@sddlZddlZddlmZddlmZddlmZddlm Z ddl m Z m Z ddl mZddlmZdd lmZmZmZdd lmZejeZGd d d e ZdS) N)Values)List) cmdoptions)make_target_python)RequirementCommand with_cleanup)SUCCESS)get_requirement_tracker) ensure_dirnormalize_path write_output) TempDirectoryc@s<eZdZdZdZddddZeeee e ddd Z dS) 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. a %prog [options] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] ... %prog [options] ... %prog [options] ...N)returnc CsL|jjtj|jjtj|jjtj|jjtj|jjtj|jjtj|jjtj |jjtj |jjtj |jjtj |jjtj |jjtj|jjtj|jjtj|jjtj|jjddddddtjddtj|jtjtj|j}|jjd ||jjd |jdS) Nz-dz--destz--destination-dirz--destination-directory download_dirdirzDownload packages into .)destmetavardefaulthelpr)cmd_opts add_optionr constraints requirementsno_depsglobal_options no_binary only_binaryZ prefer_binarysrcprerequire_hashesZ progress_barZno_build_isolationZ use_pep517Z no_use_pep517ignore_requires_pythonoscurdirZadd_target_python_optionsmake_option_group index_groupparserinsert_option_group)self index_optsr*>/tmp/pip-build-88gy_88q/pip/pip/_internal/commands/download.py add_options%s< zDownloadCommand.add_options)optionsargsrc Cs*d|_g|_tj|t|j|_t|j|j|}t|}|j ||||j d}|j t }t |j ddd}|j||||}|j||||||jdd} |j| |||j |jd} |j|| j|dd} g} x@| jjD]2} | jdkr| jdk st| j| | j| jqW| r&td d j| tS) NT)r-session target_pythonr!download)deletekindZglobally_managedF)Ztemp_build_dirr- req_trackerr/finderr use_user_site)preparerr5r-r!Zpy_version_info)Zcheck_supported_wheelszSuccessfully downloaded %s )ignore_installed editablesrZcheck_dist_restrictionr rr Zget_default_sessionr_build_package_finderr! enter_contextr r no_cleanZget_requirementsZmake_requirement_preparerZ make_resolverpython_versionZtrace_basic_inforesolvervalues satisfied_bynameAssertionErrorZsave_linked_requirementappendr joinr)r(r-r.r/r0r5r4 directoryreqsr7resolverrequirement_set downloadedreqr*r*r+runKsV          zDownloadCommand.run) __name__ __module__ __qualname____doc__usager,rrrstrintrLr*r*r*r+rs  &r)loggingr"optparserZtypingrZpip._internal.clirZpip._internal.cli.cmdoptionsrZpip._internal.cli.req_commandrrZpip._internal.cli.status_codesrZpip._internal.req.req_trackerr Zpip._internal.utils.miscr r r Zpip._internal.utils.temp_dirr getLoggerrMloggerrr*r*r*r+s