3 ]@sddlmZddlZddlZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZmZdd lmZdd lmZejeZGd d d e ZdS) )absolute_importN) CommandError) FormatControl)RequirementSet)RequirementCommand) cmdoptions) ensure_dirnormalize_path)BuildDirectory)check_path_ownercs4eZdZdZdZdZdZfddZddZZ S) 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. downloada% %prog [options] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...zDownload packages.c s\tt|j|||j}|jtj|jtj|jtj|jtj |jtj |jtj |jtj |jtj |jtj|jtj|jtj|jtj|jddddddtjdd|jd d d dd d|jd d d ddd|jdddddd|jddddddtjtj|j}|jjd||jjd|dS)Nz-dz--destz--destination-dirz--destination-directory download_dirdirzDownload packages into .)destmetavardefaulthelpz --platformplatformz`Only download wheels compatible with . Defaults to the platform of the running system.z--python-versionpython_versiona&Only download wheels compatible with Python interpreter version . If not specified, then the current system interpreter minor version is used. A major version (e.g. '2') can be specified to match all minor revs of that major version. A minor version (e.g. '34') can also be specified.z--implementationimplementationzOnly download wheels compatible with Python implementation , e.g. 'pp', 'jy', 'cp', or 'ip'. If not specified, then the current interpreter implementation is used. Use 'py' to force implementation-agnostic wheels.z--abiabizOnly download wheels compatible with Python abi , e.g. 'pypy_41'. If not specified, then the current interpreter abi tag is used. Generally you will need to specify --implementation, --platform, and --python-version when using this option.r)superr __init__cmd_opts add_optionr constraintseditable requirements build_dirno_depsglobal_options no_binary only_binarysrcpreno_cleanrequire_hashesoscurdirmake_option_groupnon_deprecated_index_groupparserinsert_option_group)selfargskwr index_opts) __class__4/tmp/pip-build-8jg9gmni/pip/pip/commands/download.pyr*sbzDownloadCommand.__init__c Csd|_|jr|jg}nd}t|j|j|j|jg}tttdg}|rZ|j|krZt dt j j |j |_ t|j|_t|j|j|}|j|||j||j|jd}|jp|j }|jrt|j rtjd|jd|_t|j|d} t| |j |jd|j||j|jd} |j| |||||jd| j s2dS| j!|dj"d d | j#D} | rdtj$d | |jst| j%WdQRXWdQRX| S) NTz:all:z--only-binary=:all: must be set and --no-binary must not be set (or must be set to :none:) when restricting platform and interpreter constraints using --python-version, --platform, --abi, or --implementation.)optionssessionrpython_versionsrrzThe 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.)delete)rsrc_dirrignore_installedignore_dependenciesr6isolatedr' cSsg|] }|jqSr3)name).0reqr3r3r4 sz'DownloadCommand.run..zSuccessfully downloaded %s)&r:ranyrrrrsetformat_controlrr(pathabspathr9r rr_build_session_build_package_finderr&r cache_dirr loggerwarningr rr; isolated_moder'populate_requirement_setr>has_requirements prepare_filesjoinsuccessfully_downloadedinfo cleanup_files) r.r5r/r7dist_restriction_set binary_onlyr6finder build_deleterrequirement_set downloadedr3r3r4run{sx         zDownloadCommand.run) __name__ __module__ __qualname____doc__r>usagesummaryrrZ __classcell__r3r3)r2r4r s   Qr ) __future__rloggingr(pip.exceptionsr pip.indexrpip.reqrpip.basecommandrpipr pip.utilsrr pip.utils.buildr pip.utils.filesystemr getLoggerr[rJr r3r3r3r4s