o
    ©„j  ã                   @   sš   d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlm	Z	m
Z
 d dlmZ d dlmZ d dlmZmZmZ d d	lmZ e  e¡ZG d
d„ de	ƒZdS )é    N)ÚValues)Ú
cmdoptions)Úmake_target_python)ÚRequirementCommandÚwith_cleanup)ÚSUCCESS)Úget_build_tracker)Ú
ensure_dirÚnormalize_pathÚwrite_output)ÚTempDirectoryc                   @   s<   e Zd ZdZdZddd„Zededee	 de
fd	d
„ƒZd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.
    a  
      %prog [options] <requirement specifier> [package-index-options] ...
      %prog [options] -r <requirements file> [package-index-options] ...
      %prog [options] <vcs project url> ...
      %prog [options] <local project path> ...
      %prog [options] <archive url/path> ...ÚreturnNc              
   C   sZ  | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t 	¡ ¡ | j  t 
¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j jddddddtjdd� t | j ¡ t tj| j¡}t tj| j¡}| j d	|¡ | j d	|¡ | j d	| j ¡ d S )
Nz-dz--destz--destination-dirz--destination-directoryÚdownload_dirÚdirzDownload packages into <dir>.)ÚdestÚmetavarÚdefaultÚhelpr   )Úcmd_optsÚ
add_optionr   ÚconstraintsÚbuild_constraintsÚrequirementsÚrequirements_from_scriptsÚno_depsÚ	only_depsÚsrcÚrequire_hashesÚno_require_hashesÚprogress_barÚno_build_isolationÚ
use_pep517Úcheck_build_depsÚignore_requires_pythonÚosÚcurdirÚadd_target_python_optionsÚmake_option_groupÚindex_groupÚparserÚpackage_selection_groupÚinsert_option_group)ÚselfÚ
index_optsÚselection_opts© r0   ú]/var/www/html/django_cbt/venv/lib/python3.10/site-packages/pip/_internal/commands/download.pyÚadd_options$   sH   øþþzDownloadCommand.add_optionsÚoptionsÚargsc                 C   sX  d|_ g |_t |¡ t |¡ t |¡ t |¡ t|jƒ|_t	|jƒ |  
|¡}t|ƒ}| j||||jd�}|  tƒ ¡}t|j ddd�}|  ||||¡}| j||||||jd| jdd�	}	| j|	|||j|jd�}
|  |¡ |
j|dd�}|	 |j ¡ ¡ g }|j ¡ D ]}|jd u rŸ|jd us”J ‚|	 |¡ | |j¡ q†|rªt d	d
 !|¡ƒ t"S )NT)r3   ÚsessionÚtarget_pythonr$   Údownload)ÚdeleteÚkindÚglobally_managedF)	Útemp_build_dirr3   Úbuild_trackerr5   Úfinderr   Úuse_user_siteÚ	verbosityÚallow_editables)Úpreparerr=   r3   r$   Úpy_version_info)Úcheck_supported_wheelszSuccessfully downloaded %sú )#Úignore_installedÚ	editablesr   Úcheck_dist_restrictionÚcheck_build_constraintsÚcheck_release_control_exclusiveÚ(check_only_deps_option_does_not_conflictr
   r   r	   Úget_default_sessionr   Ú_build_package_finderr$   Úenter_contextr   r   Úno_cleanÚget_requirementsÚmake_requirement_preparerr?   Úmake_resolverÚpython_versionÚtrace_basic_infoÚresolveÚ prepare_linked_requirements_morer   ÚvaluesÚsatisfied_byÚnameÚsave_linked_requirementÚappendr   Újoinr   )r-   r3   r4   r5   r6   r=   r<   Ú	directoryÚreqsrA   ÚresolverÚrequirement_setÚ
downloadedÚreqr0   r0   r1   ÚrunO   sl   





üý÷û


€zDownloadCommand.run)r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úusager2   r   r   ÚlistÚstrÚintrb   r0   r0   r0   r1   r      s    
+ r   )Úloggingr%   Úoptparser   Úpip._internal.clir   Úpip._internal.cli.cmdoptionsr   Úpip._internal.cli.req_commandr   r   Úpip._internal.cli.status_codesr   Ú,pip._internal.operations.build.build_trackerr   Úpip._internal.utils.miscr	   r
   r   Úpip._internal.utils.temp_dirr   Ú	getLoggerrc   Úloggerr   r0   r0   r0   r1   Ú<module>   s    
