U ��.e��@s�ddlmZddlZddlZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZmZmZdd lmZe�e�ZGd d �d e �ZdS) �)�absolute_importN)� cmdoptions)�make_target_python)�RequirementCommand)�RequirementSet)�RequirementTracker)�check_path_owner)� ensure_dir�normalize_path� write_output)� TempDirectorycs,eZdZdZdZ�fdd�Zdd�Z�ZS)�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] ...c sNtt|�j||�|j}|�t���|�t���|�t���|�t� ��|�t� ��|�t� ��|�t� ��|�t� ��|�t���|�t���|�t���|�t���|�t���|�t���|�t���|�t���|jddddddtjdd�t�|�t�tj|j�}|j�d |�|j�d |�dS) Nz-dz--destz--destination-dirz--destination-directory� download_dir�dirzDownload packages into .)�dest�metavar�default�helpr)�superr �__init__�cmd_optsZ add_optionrZ constraintsZ requirements� build_dirZno_depsZglobal_optionsZ no_binaryZ only_binaryZ prefer_binary�srcZpre�no_clean�require_hashesZ progress_barZno_build_isolationZ use_pep517Z no_use_pep517�os�curdirZadd_target_python_optionsZmake_option_groupZ index_group�parserZinsert_option_group)�self�args�kwrZ index_opts�� __class__��C/usr/lib/python3.8/site-packages/pip/_internal/commands/download.pyr)sF� �zDownloadCommand.__init__c CsLd|_g|_t�|�tj�|j�|_t|j �|_ t |j �|� |�}t |�}|j |||d�}|jph|j }|jr�t|j�s�t�d|j�d|_t���}t|j|dd���}t|jd�} |�| ||||d�|j||||j d�} |j| ||||jd�} | �| �d �d d �| jD��} | �r$td | �|j�s4| � �W5QRXW5QRX| S) NT)�options�session� target_pythonz�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.Zdownload)�deleteZkind)r)Ztemp_build_dirr%� req_trackerr)�preparer�finderr&r%Zpy_version_info� cSsg|] }|j�qSr#)�name)�.0Zreqr#r#r$� �sz'DownloadCommand.run..zSuccessfully downloaded %s)!Zignore_installedZ editablesrZcheck_dist_restrictionr�path�abspathZsrc_dirr rr Zget_default_sessionrZ_build_package_finderrr� cache_dirr�loggerZwarningrr rrZpopulate_requirement_setZmake_requirement_preparerZ make_resolverZpython_versionZresolve�joinZsuccessfully_downloadedr Z cleanup_files) rr%rr&r'r+Z build_deleter)Z directoryZrequirement_setr*ZresolverZ downloadedr#r#r$�runQsv    �� ��� ��  � zDownloadCommand.run)�__name__� __module__� __qualname__�__doc__Zusagerr5� __classcell__r#r#r!r$r s  (r )Z __future__rZloggingrZpip._internal.clirZpip._internal.cli.cmdoptionsrZpip._internal.cli.req_commandrZpip._internal.reqrZpip._internal.req.req_trackerrZpip._internal.utils.filesystemrZpip._internal.utils.miscr r r Zpip._internal.utils.temp_dirr Z getLoggerr6r3r r#r#r#r$�s