a
    b½3j:  ã                   @   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d„Zeeee	 e
dœ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> ...N)Úreturnc              
   C   s:  | 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   ÚconstraintsZbuild_constraintsÚrequirementsZrequirements_from_scriptsÚno_depsÚsrcÚrequire_hashesÚprogress_barÚno_build_isolationÚ
use_pep517Zcheck_build_depsÚignore_requires_pythonÚosÚcurdirÚadd_target_python_optionsÚmake_option_groupÚindex_groupÚparserZpackage_selection_groupÚinsert_option_group)ÚselfÚ
index_optsZselection_opts© r)   ú|/www/wwwroot/dpstar/app/297b3aabda72fedb274352021c2dd8b5_venv/lib/python3.9/site-packages/pip/_internal/commands/download.pyÚadd_options$   sD    øþþzDownloadCommand.add_options)ÚoptionsÚargsr   c              
   C   sT  d|_ g |_t |¡ t |¡ t |¡ t|jƒ|_t|jƒ |  	|¡}t
|ƒ}| j||||jd}|  tƒ ¡}t|j ddd}|  ||||¡}| j||||||jd| jd}	| j|	|||j|jd}
|  |¡ |
j|dd}|	 |j ¡ ¡ g }|j ¡ D ]8}|jd u r |jd us J ‚|	 |¡ | |j¡ q |rPtd	d
  |¡ƒ t!S )NT)r,   ÚsessionÚtarget_pythonr   Údownload)ÚdeleteÚkindÚglobally_managedF)Útemp_build_dirr,   Úbuild_trackerr.   Úfinderr   Úuse_user_siteÚ	verbosity)Úpreparerr6   r,   r   Úpy_version_info)Úcheck_supported_wheelszSuccessfully downloaded %sú )"Úignore_installedÚ	editablesr   Úcheck_dist_restrictionZcheck_build_constraintsZcheck_release_control_exclusiver
   r   r	   Úget_default_sessionr   Ú_build_package_finderr   Úenter_contextr   r   Úno_cleanÚget_requirementsÚmake_requirement_preparerr8   Úmake_resolverÚpython_versionÚtrace_basic_infoÚresolveÚ prepare_linked_requirements_morer   ÚvaluesÚsatisfied_byÚnameÚsave_linked_requirementÚappendr   Újoinr   )r'   r,   r-   r.   r/   r6   r5   Ú	directoryÚreqsr9   ÚresolverÚrequirement_setÚ
downloadedÚreqr)   r)   r*   ÚrunM   sf    




üýøû

zDownloadCommand.run)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úusager+   r   r   ÚlistÚstrÚintrW   r)   r)   r)   r*   r      s
   )r   )Úloggingr    Úoptparser   Úpip._internal.clir   Zpip._internal.cli.cmdoptionsr   Úpip._internal.cli.req_commandr   r   Úpip._internal.cli.status_codesr   Z,pip._internal.operations.build.build_trackerr   Úpip._internal.utils.miscr	   r
   r   Úpip._internal.utils.temp_dirr   Ú	getLoggerrX   Úloggerr   r)   r)   r)   r*   Ú<module>   s   
