a
    ýÓEbõl  ã                   @   sH  d dl Z d dlZd dlZd dlZd dlZd dlmZmZ d dlm	Z	m
Z
mZ d dlmZ d dl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mZ d d
lmZm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, d dl-m.Z. d dl/m0Z0 d dl1m2Z2 d dl3m4Z4 d dl5m6Z6m7Z7m8Z8m9Z9 d dl:m;Z; d dl<m=Z=m>Z> d dl?m@Z@mAZAmBZB e4eCƒZDe#e@dœdd„ZEG dd„ deƒZFd/eGeeH eeH eGeeH e
eH d œd!d"„ZIeeH eGeGd#œd$d%„ZJd0eeG eeH eeH eeH eGeGd&œd'd(„ZKe
e* ee
eH  dd)œd*d+„ZLeMeGeGeHd,œd-d.„ZNdS )1é    N)ÚSUPPRESS_HELPÚValues)ÚIterableÚListÚOptional)Úcanonicalize_name)Ú
WheelCache)Ú
cmdoptions)Úmake_target_python)ÚRequirementCommandÚwarn_if_run_as_rootÚwith_cleanup)ÚERRORÚSUCCESS)ÚCommandErrorÚInstallationError)Ú
get_scheme)Úget_environment)ÚFormatControl)ÚConflictDetailsÚcheck_install_conflicts)Úinstall_given_reqs)ÚInstallRequirement)Úget_requirement_tracker)ÚWINDOWS)Úparse_distutils_args©Útest_writable_dir)Ú	getLogger)Ú
ensure_dirÚget_pip_versionÚ(protect_pip_from_modification_on_windowsÚwrite_output)ÚTempDirectory)Úrunning_under_virtualenvÚvirtualenv_no_global)ÚBinaryAllowedPredicateÚbuildÚ should_build_for_install_command)Úformat_controlÚreturnc                    s   t tdœ‡ fdd„}|S )N)Úreqr*   c                    s    t | jp
dƒ}ˆ  |¡}d|v S )NÚ Úbinary)r   ÚnameÚget_allowed_formats)r+   Úcanonical_nameZallowed_formats©r)   © ú^/home/ja/django-apps/lartica_env/lib/python3.9/site-packages/pip/_internal/commands/install.pyÚcheck_binary_allowed5   s    
z6get_check_binary_allowed.<locals>.check_binary_allowed)r   Úbool)r)   r4   r2   r1   r3   Úget_check_binary_allowed4   s    r6   c                   @   sz   e Zd ZdZdZddœdd„Zeeee	 e
dœdd	„ƒZe	eedd
œdd„Zee ee dœdd„Zee	ddœdd„ZdS )ÚInstallCommandaI  
    Install packages from:

    - PyPI (and other indexes) using requirement specifiers.
    - VCS project urls.
    - Local project directories.
    - Local or remote source archives.

    pip also supports installing from "requirements files", which provide
    an easy way to specify a whole environment to be installed.
    a%  
      %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> ...N)r*   c                 C   sj  | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j jddddd dd� t | j ¡ | j jddd	d
d� | j jdddt	d� | j jdddd dd� | j jdddd dd� | j  t 
¡ ¡ | j jdddd	dd� | j jdddddgdd� | j jddd	d d� | j jd!d"d#d	d$d� | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j jd%d	d&d'd(d)� | j jd*dd&d+d,� | j jd-dd.d'd/d)� | j jd0dd1d'd2d)� | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ t tj| j¡}| j d3|¡ | j d3| j ¡ d S )4Nz-tz--targetÚ
target_dirÚdirz¥Install packages into <dir>. By default this will not replace existing files/folders in <dir>. Use --upgrade to replace existing packages in <dir> with new versions.)ÚdestÚmetavarÚdefaultÚhelpz--userÚuse_user_siteÚ
store_truez¸Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%\Python on Windows. (See the Python documentation for site.USER_BASE for full details.))r:   Úactionr=   z	--no-userÚstore_falsez--rootÚ	root_pathz=Install everything relative to this alternate root directory.z--prefixÚprefix_pathzIInstallation prefix where lib, bin and other top-level folders are placedz-Uz	--upgradeÚupgradez‚Upgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade-strategy used.z--upgrade-strategyÚupgrade_strategyzonly-if-neededZeageraG  Determines how dependency upgrading should be handled [default: %default]. "eager" - dependencies are upgraded regardless of whether the currently installed version satisfies the requirements of the upgraded package(s). "only-if-needed" -  are upgraded only when they do not satisfy the requirements of the upgraded package(s).)r:   r<   Úchoicesr=   z--force-reinstallÚforce_reinstallz;Reinstall all packages even if they are already up-to-date.z-Iz--ignore-installedÚignore_installedz°Ignore the installed packages, overwriting them. This can break your system if the existing package is of a different version or was installed with a different package manager!z	--compileÚcompileTz'Compile Python source files to bytecode)r@   r:   r<   r=   z--no-compilez.Do not compile Python source files to bytecode)r@   r:   r=   z--no-warn-script-locationÚwarn_script_locationz0Do not warn when installing scripts outside PATHz--no-warn-conflictsÚwarn_about_conflictsz%Do not warn about broken dependenciesr   )Úcmd_optsÚ
add_optionr	   ÚrequirementsÚconstraintsÚno_depsÚpreÚeditableÚadd_target_python_optionsr   ÚsrcÚignore_requires_pythonÚno_build_isolationÚ
use_pep517Úno_use_pep517Úinstall_optionsÚglobal_optionsÚ	no_binaryÚonly_binaryÚprefer_binaryÚrequire_hashesÚprogress_barÚmake_option_groupÚindex_groupÚparserÚinsert_option_group)ÚselfZ
index_optsr2   r2   r3   Úadd_optionsQ   sà    ùûüûúúúüúûüûûþzInstallCommand.add_options)ÚoptionsÚargsr*   c           )         s2  |j r|jd urtdƒ‚t |¡ d}|jr2|j}tj|dd� |jpHg }t	 
dtƒ ¡ t|j |j|j|j|jd�|_ d }d }|jrØd|_tj |j¡|_tj |j¡r¾tj |j¡s¾tdƒ‚tdd	�}|j}|  |¡ |jpàg }|  |¡}t|ƒ}	| j|||	|jd
�}
t|j|jƒ}|  t ƒ ¡}t|j! ddd�}�z||  "|||
|¡}|D ]}d|_#�qLt$||jƒ | j%|||||
|j | j&d�}| j'||
|||j |j|j|j(||j)d�
}|  *|
¡ |j+||j d�}z| ,d¡}W n t-�yì   d}Y n0 |j.d u }t/|d� t0|
jƒ‰ ‡ fdd„|j1 2¡ D ƒ}t3||dg g d�\}}dd„ |D ƒ}|�rbt4d 5d 6|¡¡ƒ‚|D ]}|j)�sfd|_7�qf| 8|¡}d }|j9 �o˜|j:}|�rª|  ;|¡}|j<}|j�sÀ|j�rÄd}t=||||j||j||j |j>d�	}t?|j ||j|j|jd�}t@|ƒ} |jAtB Cd¡d� g }!|D ]T}"|"jD}#z(|  E|#¡}$|$d u�rR|#› d|$jF› �}#W n tG�yh   Y n0 |! H|#¡ �q"|d u�r–| jI||  J|¡d� d  6|!¡}%|%�r°tKd!|%ƒ W nP tL�y }& z6| j&d"k}'tM|&|'|j ƒ}(t	jN|(|'d#� tOW  Y d }&~&S d }&~&0 0 |j�r(|�sJ ‚|  P|j||j¡ tQƒ  tRS )$Nz'Can not combine '--user' and '--target'zto-satisfy-onlyT)Úcheck_targetzUsing %s)rC   r8   rB   Úisolated_modez=Target path exists but is not a directory, will not continue.Útarget)Úkind)rf   ÚsessionÚtarget_pythonrU   Úinstall)Údeleterk   Úglobally_managed)Ztemp_build_dirrf   Úreq_trackerrl   Úfinderr>   Ú	verbosity)
Úpreparerrr   rf   Úwheel_cacher>   rH   rU   rG   rE   rW   )Zcheck_supported_wheelsÚpipF)Úmodifying_pipc                    s   g | ]}t |ˆ ƒr|‘qS r2   )r(   ©Ú.0Úr©r4   r2   r3   Ú
<listcomp>c  s   
þz&InstallCommand.run.<locals>.<listcomp>)ru   ÚverifyÚbuild_optionsrZ   c                 S   s   g | ]}|j r|j‘qS r2   )rW   r.   rx   r2   r2   r3   r|   s  s   zYCould not build wheels for {}, which is required to install pyproject.toml-based projectsz, i°   )ÚrootÚhomeÚprefixrJ   r>   Z	pycompile)Úuserr€   r   r�   Úisolatedr.   )Úkeyú-)Úresolver_variantú zSuccessfully installed %sé   )Úexc_info)Sr>   r8   r   r	   Úcheck_install_build_globalrD   rE   Úcheck_dist_restrictionrY   ÚloggerÚverboser    Údecide_user_installrC   rB   ri   rH   ÚosÚpathÚabspathÚexistsÚisdirr#   Úenter_contextrZ   Zget_default_sessionr
   Z_build_package_finderrU   r   Ú	cache_dirr)   r   Úno_cleanZget_requirementsZpermit_editable_wheelsÚ'reject_location_related_install_optionsZmake_requirement_preparerrs   Zmake_resolverrG   rW   Ztrace_basic_infoÚresolveZget_requirementÚKeyErrorZsatisfied_byr!   r6   rN   Úvaluesr'   r   ÚformatÚjoinZlegacy_install_reasonZget_installation_orderÚignore_dependenciesrK   Ú_determine_conflictsrJ   r   rI   Úget_lib_location_guessesr   ÚsortÚoperatorÚ
attrgetterr.   Úget_distributionÚversionÚ	ExceptionÚappendÚ_warn_about_conflictsZdetermine_resolver_variantr"   ÚOSErrorÚcreate_os_error_messageÚerrorr   Ú_handle_target_dirr   r   ))rd   rf   rg   rE   rY   Útarget_temp_dirZtarget_temp_dir_pathrZ   rl   rm   rr   ru   rq   Ú	directoryZreqsr+   rt   ZresolverZrequirement_setZpip_reqrw   Zreqs_to_buildÚ_Zbuild_failuresZpep517_build_failure_namesrz   Ú
to_installZ	conflictsZshould_warn_about_conflictsrJ   Ú	installedZlib_locationsÚenvÚitemsÚresultÚitemZinstalled_distZinstalled_descrª   Úshow_tracebackÚmessager2   r{   r3   Úrunð   sX   

ûþýÿ



üý
ù	ö
ÿ




þû

ÿþÿ


ÿ
÷û


þ
þ
ý

ÿzInstallCommand.run)r8   r¬   rD   r*   c                    sN  t |ƒ g }td|jd�}|j}|j}|j}tj |¡rB| |¡ tj |¡r`||kr`| |¡ tj |¡rv| |¡ |D ]Î}	t 	|	¡D ]¾}
|	|krÂtj 
||
¡‰ t‡ fdd„|d d… D ƒƒrÂqˆtj 
||
¡}tj |¡�r0|sðt d|¡ qˆtj |¡�rt d|¡ qˆtj |¡�r&t |¡ n
t |¡ t tj 
|	|
¡|¡ qˆqzd S )Nr,   )r€   c                 3   s   | ]}|  ˆ ¡V  qd S ©N)Ú
startswith)ry   Ús©Zddirr2   r3   Ú	<genexpr>ò  ó    z4InstallCommand._handle_target_dir.<locals>.<genexpr>éÿÿÿÿzKTarget directory %s already exists. Specify --upgrade to force replacement.z„Target directory %s already exists and is a link. pip will not automatically replace links, please remove if replacement is desired.)r   r   r�   ÚpurelibÚplatlibÚdatar�   r’   r¦   Úlistdirrœ   ÚanyrŒ   ÚwarningÚislinkr“   ÚshutilÚrmtreeÚremoveÚmove)rd   r8   r¬   rD   Zlib_dir_listÚschemeZpurelib_dirZplatlib_dirZdata_dirÚlib_dirr´   Ztarget_item_dirr2   r»   r3   r«   ×  sH    


ýû
z!InstallCommand._handle_target_dir)r¯   r*   c                 C   s.   z
t |ƒW S  ty(   t d¡ Y d S 0 d S )NzwError while checking for conflicts. Please file an issue on pip's issue tracker: https://github.com/pypa/pip/issues/new)r   r¥   rŒ   Ú	exception)rd   r¯   r2   r2   r3   rž     s    
ÿz#InstallCommand._determine_conflicts)Úconflict_detailsr†   r*   c              
   C   sò   |\}\}}|s|sd S g }|dkr0|  d¡ n|dks<J ‚|  d¡ |D ]<}|| d }|| D ]"}	dj|||	d d�}
|  |
¡ qbqJ|D ]P}|| d }|| D ]6\}}}d	j||||||dkrÈd
ndd�}
|  |
¡ q¤qŒt d |¡¡ d S )NZlegacyz¤pip's legacy dependency resolver does not consider dependency conflicts when selecting packages. This behaviour is the source of the following dependency conflicts.z2020-resolverz§pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.r   z@{name} {version} requires {requirement}, which is not installed.rˆ   )r.   r¤   Úrequirementzg{name} {version} requires {requirement}, but {you} have {dep_name} {dep_version} which is incompatible.Úyouzyou'll)r.   r¤   rÎ   Údep_nameÚdep_versionrÏ   Ú
)r¦   r›   rŒ   Úcriticalrœ   )rd   rÍ   r†   Zpackage_setÚmissingZconflictingÚpartsZproject_namer¤   Ú
dependencyr¶   rÐ   rÑ   r+   r2   r2   r3   r§     sH    ÿÿÿúÿ÷z$InstallCommand._warn_about_conflicts)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úusagere   r   r   r   ÚstrÚintr·   r#   r5   r«   r   r   r   rž   r§   r2   r2   r2   r3   r7   =   s       hþ7þþr7   F)r‚   r€   r   rƒ   r�   r*   c                 C   s    t d| ||||d�}|j|jgS )Nr,   )r‚   r€   r   rƒ   r�   )r   r¿   rÀ   )r‚   r€   r   rƒ   r�   rÊ   r2   r2   r3   rŸ   P  s    úrŸ   )r   rƒ   r*   c                 C   s   t dd„ tt| |d�ƒD ƒƒS )Nc                 s   s   | ]}t |ƒV  qd S r¸   r   )ry   Údr2   r2   r3   r¼   c  s   ÿz)site_packages_writable.<locals>.<genexpr>©r   rƒ   )ÚallÚsetrŸ   rß   r2   r2   r3   Úsite_packages_writableb  s    þrâ   )r>   rC   r8   rB   ri   r*   c                 C   s¤   | dur| st  d¡ dS | rF|r*tdƒ‚tƒ r8tdƒ‚t  d¡ dS | du sRJ ‚|sZ|rht  d¡ dS tjs|t  d	¡ dS t||d
�r–t  d¡ dS t  d¡ dS )aZ  Determine whether to do a user install based on the input options.

    If use_user_site is False, no additional checks are done.
    If use_user_site is True, it is checked for compatibility with other
    options.
    If use_user_site is None, the default behaviour depends on the environment,
    which is provided by the other arguments.
    Nz$Non-user install by explicit requestFzVCan not combine '--user' and '--prefix' as they imply different installation locationszZCan not perform a '--user' install. User site-packages are not visible in this virtualenv.z User install by explicit requestTz3Non-user install due to --prefix or --target optionz4Non-user install because user site-packages disabledrß   z0Non-user install because site-packages writeablezMDefaulting to user installation because normal site-packages is not writeable)	rŒ   Údebugr   r%   r   ÚsiteÚENABLE_USER_SITErâ   Úinfo)r>   rC   r8   rB   ri   r2   r2   r3   rŽ   i  s8    
ÿÿ



ÿrŽ   )rN   rf   r*   c                 C   sš   t t tt dœdd„}g }| D ]0}|j}t|ƒ}|r | d || ¡ ƒ|¡¡ q |rzt|ƒ}|rz| d || ¡ ƒ¡¡ |s‚dS td d 	|¡¡ƒ‚dS )	z’If any location-changing --install-option arguments were passed for
    requirements or on the command-line, then show a deprecation warning.
    )Úoption_namesr*   c                 S   s   dd„ | D ƒS )Nc                 S   s   g | ]}d   | dd¡¡‘qS )z--{}r®   r…   )r›   Úreplace)ry   r.   r2   r2   r3   r|   ®  r½   zSreject_location_related_install_options.<locals>.format_options.<locals>.<listcomp>r2   )rç   r2   r2   r3   Úformat_options­  s    z?reject_location_related_install_options.<locals>.format_optionsz{!r} from {}z{!r} from command lineNz˜Location-changing options found in --install-option: {}. This is unsupported, use pip-level options like --user, --prefix, --root, and --target instead.z; )
r   rÜ   r   rY   r   r¦   r›   Úkeysr   rœ   )rN   rf   ré   Z	offendersrÎ   rY   Zlocation_optionsr2   r2   r3   r—   ¦  s0    ÿÿÿþÿr—   )rª   rµ   Úusing_user_siter*   c                 C   sÎ   g }|  d¡ |s,|  d¡ |  t| ƒ¡ n
|  d¡ |d  d7  < | jtjkrŽd}d}tƒ sz|sz| |d| ¡ g¡ n
|  |¡ |  d	¡ tr¼| jtjkr¼| j	r¼t
| j	ƒd
kr¼|  d¡ d |¡ ¡ d S )zrFormat an error message for an OSError

    It may occur anytime during the execution of the install command.
    z,Could not install packages due to an OSErrorz: Ú.r¾   rÒ   z"Consider using the `--user` optionzCheck the permissionsz or z.
i  zÉHINT: This error might have occurred since this system does not have Windows Long Path support enabled. You can find information on how to enable this at https://pip.pypa.io/warnings/enable-long-paths
r,   )r¦   rÜ   ÚerrnoZEACCESr$   ÚextendÚlowerr   ÚENOENTÚfilenameÚlenrœ   Ústrip)rª   rµ   rë   rÕ   Zuser_option_partZpermissions_partr2   r2   r3   r©   Í  s>    



ýÿ

ÿ
þýüÿr©   )FNNFN)NNNF)Orí   r¡   r�   rÆ   rä   Úoptparser   r   Útypingr   r   r   Úpip._vendor.packaging.utilsr   Zpip._internal.cacher   Úpip._internal.clir	   Zpip._internal.cli.cmdoptionsr
   Zpip._internal.cli.req_commandr   r   r   Úpip._internal.cli.status_codesr   r   Úpip._internal.exceptionsr   r   Úpip._internal.locationsr   Úpip._internal.metadatar   Ú#pip._internal.models.format_controlr   Zpip._internal.operations.checkr   r   Zpip._internal.reqr   Zpip._internal.req.req_installr   Zpip._internal.req.req_trackerr   Úpip._internal.utils.compatr   Z"pip._internal.utils.distutils_argsr   Úpip._internal.utils.filesystemr   Úpip._internal.utils.loggingr   Úpip._internal.utils.miscr   r    r!   r"   Úpip._internal.utils.temp_dirr#   Úpip._internal.utils.virtualenvr$   r%   Zpip._internal.wheel_builderr&   r'   r(   r×   rŒ   r6   r7   r5   rÜ   rŸ   râ   rŽ   r—   r¨   r©   r2   r2   r2   r3   Ú<module>   s†   	         ûú	    ûú>þ(þ