3

Q'íc‚ã@sžddlmZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZmZdd	lmZdd
lmZejeƒZGdd„deƒZdS)
é)Úabsolute_importN)ÚCommandError)Ú
FormatControl)ÚRequirementSet)ÚRequirementCommand)Ú
cmdoptions)Ú
ensure_dirÚnormalize_path)ÚBuildDirectory)Úcheck_path_ownercs4eZdZdZdZdZdZ‡fdd„Zdd„Z‡Z	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] <requirement specifier> [package-index-options] ...
      %prog [options] -r <requirements file> [package-index-options] ...
      %prog [options] [-e] <vcs project url> ...
      %prog [options] [-e] <local project path> ...
      %prog [options] <archive url/path> ...zDownload packages.c
s\tt|ƒj||Ž|j}|jtjƒƒ|jtjƒƒ|jtjƒƒ|jtj	ƒƒ|jtj
ƒƒ|jtjƒƒ|jtjƒƒ|jtj
ƒƒ|jtjƒƒ|jtjƒƒ|jtjƒƒ|jtjƒƒ|jddddddtjdd|jd	d
d
ddd|jdd
d
ddd|jdddddd|jddddddtjtj|jƒ}|jjd|ƒ|jjd|ƒdS)Nz-dz--destz--destination-dirz--destination-directoryÚdownload_dirÚdirzDownload packages into <dir>.)ÚdestÚmetavarÚdefaultÚhelpz
--platformÚplatformz`Only download wheels compatible with <platform>. Defaults to the platform of the running system.z--python-versionÚpython_versiona&Only download wheels compatible with Python interpreter version <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--implementationÚimplementationzçOnly download wheels compatible with Python implementation <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--abiÚabizöOnly download wheels compatible with Python abi <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ÚconstraintsÚeditableÚrequirementsÚ	build_dirÚno_depsÚglobal_optionsÚ	no_binaryÚonly_binaryÚsrcÚpreÚno_cleanÚrequire_hashesÚosÚcurdirÚmake_option_groupÚnon_deprecated_index_groupÚparserÚinsert_option_group)ÚselfÚargsÚkwrÚ
index_opts)Ú	__class__©ú4/tmp/pip-build-l_bcah40/pip/pip/commands/download.pyr*sbzDownloadCommand.__init__cCsŒd|_|jr|jg}nd}t|j|j|j|jgƒ}ttƒtdgƒƒ}|rZ|j|krZt	dƒ‚t
jj|j
ƒ|_
t|jƒ|_t|jƒ|j|ƒø}|j|||j||j|jd}|jp²|j}|jrÜt|jƒrÜtjd|jƒd|_t|j|dŽ}	t|	|j
|jd|j||j|jd}
|j|
|||||jdƒ|
j s2dS|
j!|ƒdj"d	d
„|
j#Dƒƒ}|rdtj$d|ƒ|jst|
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.)ÚoptionsÚsessionrÚpython_versionsrrzÝThe 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)rÚsrc_dirrÚignore_installedÚignore_dependenciesr6Úisolatedr'ú cSsg|]
}|j‘qSr3)Úname)Ú.0Úreqr3r3r4ú
<listcomp>Ész'DownloadCommand.run.<locals>.<listcomp>zSuccessfully downloaded %s)&r:rÚanyrrrrÚsetÚformat_controlrr(ÚpathÚabspathr9r	rrÚ_build_sessionÚ_build_package_finderr&rÚ	cache_dirrÚloggerÚwarningr
rr;Ú
isolated_moder'Úpopulate_requirement_setr>Úhas_requirementsÚ
prepare_filesÚjoinÚsuccessfully_downloadedÚinfoÚ
cleanup_files)r.r5r/r7Údist_restriction_setÚbinary_onlyr6ÚfinderÚbuild_deleterÚrequirement_setÚ
downloadedr3r3r4Úrun{sx






zDownloadCommand.run)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r>ÚusageÚsummaryrrZÚ
__classcell__r3r3)r2r4rsQr)Ú
__future__rÚloggingr(Úpip.exceptionsrÚ	pip.indexrÚpip.reqrÚpip.basecommandrÚpiprÚ	pip.utilsrr	Úpip.utils.buildr
Úpip.utils.filesystemrÚ	getLoggerr[rJrr3r3r3r4Ú<module>s