o
    ñ‘Ojkv  ã                   @   sž  d dl Z 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 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( d dl)m*Z* d dl+m,Z,m-Z- d dl.m/Z/ d dl0m1Z1 d dl2m3Z3 d dl4m5Z5 d dl6m7Z7 d dl8m9Z9 d dl:m;Z;m<Z<m=Z=m>Z> d dl?m@Z@ d dlAmBZBmCZC d dlDmEZEmFZFmGZG e9eHƒZIde&deEfdd„ZJG d d!„ d!eƒZK	"			"	d<d#eLd$eeM d%eeM d&eLd'eeM deeM fd(d)„ZNd%eeM d&eLdeLfd*d+„ZO				"d=d,eeL d-eeM d.eeM d/eeM d0eLdeLfd1d2„ZPd3ee1 d4eeeM  ddfd5d6„ZQd7eRd8eLd9eLdeMfd:d;„ZSdS )>é    N)ÚSUPPRESS_HELPÚValues)ÚIterableÚListÚOptional)Úcanonicalize_name)Ú
print_json)Ú
WheelCache)Ú
cmdoptions)Úmake_target_python)ÚRequirementCommandÚwarn_if_run_as_rootÚwith_cleanup)ÚERRORÚSUCCESS)ÚCommandErrorÚInstallationError)Ú
get_scheme)Úget_environment)ÚFormatControl)ÚInstallationReport)Úget_build_tracker)ÚConflictDetailsÚcheck_install_conflicts)Úinstall_given_reqs)ÚInstallRequirement)Ú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   dt dtf‡ fdd„}|S )NÚreqr,   c                    s    t | jpdƒ}ˆ  |¡}d|v S )NÚ Úbinary)r   ÚnameÚget_allowed_formats)r-   Úcanonical_nameÚallowed_formats©r+   © úd/var/www/html/pharmsmart-cdr-gen/venv/lib/python3.10/site-packages/pip/_internal/commands/install.pyÚcheck_binary_allowed8   s   
z6get_check_binary_allowed.<locals>.check_binary_allowed)r   Úbool)r+   r7   r5   r4   r6   Úget_check_binary_allowed7   s   r9   c                   @   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e	dededdfdd„Zdee dee fdd„Zdede	ddf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> ...r,   Nc                 C   sÆ  | 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 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  t ¡ ¡ | j  t ¡ ¡ | j jd*dd+d,d-d� | j jd.dd+d/d0� | j jd1dd2d,d3d� | j jd4dd5d,d6d� | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ t tj| j¡}| j d7|¡ | j d7| j ¡ | j jd8d9d:d d;d� d S )<Nz	--dry-runÚ
store_trueÚdry_runFzŒDon't actually install anything, just print what would be. Can be used in combination with --ignore-installed to 'resolve' the requirements.)ÚactionÚdestÚdefaultÚhelpz-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.)r>   Úmetavarr?   r@   z--userÚuse_user_sitez¸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>   r=   r@   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-neededÚ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 bytecodez--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   z--reportÚjson_report_fileÚfilezãGenerate a JSON file describing what pip did to install the provided requirements. Can be used in combination with --dry-run and --ignore-installed to 'resolve' the requirements. When - is used as file name it writes to stdout.)Ú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Úcheck_build_depsÚconfig_settingsÚinstall_optionsÚglobal_optionsÚ	no_binaryÚonly_binaryÚprefer_binaryÚrequire_hashesÚprogress_barÚroot_user_actionÚmake_option_groupÚindex_groupÚparserÚinsert_option_group)ÚselfÚ
index_optsr5   r5   r6   Úadd_optionsT   s  úùûüûúúúüúûüûûþ
úzInstallCommand.add_optionsÚoptionsÚargsc           ,         sü  |j r|jd urtdƒ‚t |¡ d}|jr|j}tj|dd� |jp$g }t	 
dtƒ ¡ t|j |j|j|j|jd�|_ d }d }|jrld|_tj |j¡|_tj |j¡r_tj |j¡s_tdƒ‚tdd	�}|j}|  |¡ |jppg }|  |¡}t|ƒ}	| j|||	|jd
�}
t|j|jƒ}|  t ƒ ¡}t|j! ddd�}�z�|  "|||
|¡}|D ]}d|_#q¦t$||jƒ | j%|||||
|j | j&d�}| j'||
|||j |j|j|j(||j)d�
}|  *|
¡ |j+||j d�}|j,�r!t	 -d¡ t.|j/ƒ}|j,dkrýt0| 1¡ d� n$t2|j,ddd��}t3j4| 1¡ |ddd� W d   ƒ n	1 �sw   Y  |j5�rBt6dd„ |j/D ƒƒ}|�r?t7dd 8dd„ |D ƒ¡ƒ t9W S z| :d¡}W n t;�yU   d}Y nw |j<d u }t=|d� t>|
jƒ‰ ‡ fd d!„|j? @¡ D ƒ}tA||dg g d"�\}}d#d!„ |D ƒ}|�r�tBd$ Cd% 8|¡¡ƒ‚|D ]
}|j)�s›d&|_D�q’| E|¡}d }|jF �o«|jG}|�r´|  H|¡}|jI} |j�s¿|j�rÁd} tJ||||j||j| |j |jKd'�	}!tL|j ||j|j|jd(�}"tM|"ƒ}#|!jNtO Pd)¡d*� g }$|!D ]*}%|%jQ}&z|# R|&¡}'|'d u�r|&› d|'jS› �}&W n
 tT�y   Y nw |$ U|&¡ �qð|d u�r*| jV||  W|¡d+� d 8|$¡}(|(�r7t7d,|(ƒ W n( tX�y` }) z| j&d-k}*tY|)|*|j ƒ}+t	jZ|+|*d.� t[W  Y d })~)S d })~)ww |j�rs|�sjJ ‚|  \|j||j¡ |j]d/k�r|t^ƒ  t9S )0Nz'Can not combine '--user' and '--target'zto-satisfy-onlyT)Úcheck_targetzUsing %s)rG   rA   rF   Úisolated_modez=Target path exists but is not a directory, will not continue.Útarget)Úkind)rq   ÚsessionÚtarget_pythonr\   Úinstall)Údeleterv   Úglobally_managed)Útemp_build_dirrq   Úbuild_trackerrw   ÚfinderrD   Ú	verbosity)
Úpreparerr~   rq   Úwheel_cacherD   rM   r\   rL   rI   r^   )Úcheck_supported_wheelszu--report is currently an experimental option. The output format may change in a future release without prior warning.ú-)ÚdataÚwzutf-8)Úencodingé   F)ÚindentÚensure_asciic                 s   s$   � | ]}|j d  |j d fV  qdS )r0   ÚversionN)Úmetadata©Ú.0Úrr5   r5   r6   Ú	<genexpr>„  s
   € ÿ
ÿz%InstallCommand.run.<locals>.<genexpr>zWould install %sú c                 s   s   � | ]}d   |¡V  qdS )rƒ   N)Újoin)r�   Úitemr5   r5   r6   r�   ‹  ó   € Úpip)Úmodifying_pipc                    s   g | ]	}t |ˆ ƒr|‘qS r5   )r*   rŒ   ©r7   r5   r6   Ú
<listcomp>›  s    ýÿz&InstallCommand.run.<locals>.<listcomp>)r�   ÚverifyÚbuild_optionsrc   c                 S   s   g | ]}|j r|j‘qS r5   )r^   r0   rŒ   r5   r5   r6   r—   «  s
    ÿÿzYCould not build wheels for {}, which is required to install pyproject.toml-based projectsz, i°   )ÚrootÚhomeÚprefixrO   rD   Ú	pycompile)Úuserr›   rš   rœ   Úisolatedr0   )Úkey)Úresolver_variantzSuccessfully installed %sé   )Úexc_infoÚwarn)_rD   rA   r   r
   Úcheck_install_build_globalrH   rI   Úcheck_dist_restrictionrb   ÚloggerÚverboser"   Údecide_user_installrG   rF   rt   rM   ÚosÚpathÚabspathÚexistsÚisdirr%   Úenter_contextrc   Úget_default_sessionr   Ú_build_package_finderr\   r	   Ú	cache_dirr+   r   Úno_cleanÚget_requirementsÚpermit_editable_wheelsÚ'reject_location_related_install_optionsÚmake_requirement_preparerr   Úmake_resolverrL   r^   Útrace_basic_infoÚresolverQ   Úwarningr   Úrequirements_to_installr   Úto_dictÚopenÚjsonÚdumpr<   Úsortedr$   r‘   r   Úget_requirementÚKeyErrorÚsatisfied_byr#   r9   rU   Úvaluesr)   r   ÚformatÚlegacy_install_reasonÚget_installation_orderÚignore_dependenciesrP   Ú_determine_conflictsrO   r   rN   Úget_lib_location_guessesr   ÚsortÚoperatorÚ
attrgetterr0   Úget_distributionrŠ   Ú	ExceptionÚappendÚ_warn_about_conflictsÚdetermine_resolver_variantÚOSErrorÚcreate_os_error_messageÚerrorr   Ú_handle_target_dirri   r   ),rn   rq   rr   rI   rb   Útarget_temp_dirÚtarget_temp_dir_pathrc   rw   rx   r~   r�   r}   Ú	directoryÚreqsr-   r€   ÚresolverÚrequirement_setÚreportÚfÚwould_install_itemsÚpip_reqr•   Úreqs_to_buildÚ_Úbuild_failuresÚpep517_build_failure_namesrŽ   Ú
to_installÚ	conflictsÚshould_warn_about_conflictsrO   Ú	installedÚlib_locationsÚenvÚitemsÚresultr’   Úinstalled_distÚinstalled_descrÖ   Úshow_tracebackÚmessager5   r–   r6   Úrun  s’  

ûþýÿ



üýù	ö
ÿÿ

ÿþþÿ



þ
û
ÿÿþ
€
ÿ
÷û

€ÿ
þ
þ€
ý€ö

ÿzInstallCommand.runrA   rØ   rH   c                    sH  t |ƒ g }td|jd�}|j}|j}|j}tj |¡r!| |¡ tj |¡r0||kr0| |¡ tj |¡r;| |¡ |D ]d}	t 	|	¡D ]\}
|	|kratj 
||
¡‰ t‡ fdd„|d d… D ƒƒraqDtj 
||
¡}tj |¡r•|swt d|¡ qDtj |¡r„t d|¡ qDtj |¡r�t |¡ nt |¡ t tj 
|	|
¡|¡ qDq=d S )Nr.   )r›   c                 3   s   � | ]}|  ˆ ¡V  qd S ©N)Ú
startswith)r�   Ús©Úddirr5   r6   r�   *  r“   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Úplatlibr„   rª   r­   rÑ   Úlistdirr‘   Úanyr§   r»   Úislinkr®   ÚshutilÚrmtreeÚremoveÚmove)rn   rA   rØ   rH   Úlib_dir_listÚschemeÚpurelib_dirÚplatlib_dirÚdata_dirÚlib_dirr’   Útarget_item_dirr5   rö   r6   r×     sL   


ýû
äÿz!InstallCommand._handle_target_dirræ   c                 C   s*   zt |ƒW S  ty   t d¡ Y d S w )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)rn   ræ   r5   r5   r6   rÊ   E  s   
ÿûz#InstallCommand._determine_conflictsÚconflict_detailsr¡   c              
   C   sò   |\}\}}|s|sd S g }|dkr|  d¡ n|dksJ ‚|  d¡ |D ]}|| d }|| D ]}	dj|||	d d�}
|  |
¡ q1q%|D ](}|| d }|| D ]\}}}d	j||||||dkrdd
ndd�}
|  |
¡ qRqFt d |¡¡ d S )NÚ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¢   )r0   rŠ   Úrequirementzg{name} {version} requires {requirement}, but {you} have {dep_name} {dep_version} which is incompatible.Úyouzyou'll)r0   rŠ   r  Údep_nameÚdep_versionr  Ú
)rÑ   rÆ   r§   Úcriticalr‘   )rn   r
  r¡   Úpackage_setÚmissingÚconflictingÚpartsÚproject_namerŠ   Ú
dependencyrñ   r  r  r-   r5   r5   r6   rÒ   Q  sL   ÿÿú÷÷ôz$InstallCommand._warn_about_conflicts)r,   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úusagerp   r   r   r   ÚstrÚintrò   r%   r8   r×   r   r   r   rÊ   rÒ   r5   r5   r5   r6   r:   @   s<    
 ;  ÿÿÿ
þ6ÿ
þÿÿþr:   Frž   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  r5   r5   r6   rË   ˆ  s   úrË   c                 C   s   t dd„ tt| |d�ƒD ƒƒS )Nc                 s   s   � | ]}t |ƒV  qd S ró   r   )r�   Údr5   r5   r6   r�   ›  s
   € ÿ
ÿz)site_packages_writable.<locals>.<genexpr>©rš   rŸ   )ÚallÚsetrË   r   r5   r5   r6   Úsite_packages_writableš  s   þr#  rD   rG   rA   rF   rt   c                 C   s¤   | dur| st  d¡ dS | r#|rtdƒ‚tƒ rtdƒ‚t  d¡ dS | du s)J ‚|s-|r4t  d¡ dS tjs>t  d	¡ dS t||d
�rKt  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)rD   rG   rA   rF   rt   r5   r5   r6   r©   ¡  s8   
ÿÿ



ÿr©   rU   rq   c                 C   s˜   dt t dtt fdd„}g }| D ]}|j}t|ƒ}|r)| d || ¡ ƒ|¡¡ q|r>t|ƒ}|r>| d || ¡ ƒ¡¡ |sBdS td d	 	|¡¡ƒ‚)
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)r�   r0   r5   r5   r6   r—   æ  s    zSreject_location_related_install_options.<locals>.format_options.<locals>.<listcomp>r5   )r(  r5   r5   r6   Ú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   rb   r   rÑ   rÆ   Úkeysr   r‘   )rU   rq   r*  Ú	offendersr  rb   Úlocation_optionsr5   r5   r6   r¶   Þ  s0   ÿÿ€ÿýr¶   rÖ   rð   Úusing_user_sitec                 C   sÎ   g }|  d¡ |s|  d¡ |  t| ƒ¡ n|  d¡ |d  d7  < | jtjkrGd}d}tƒ s=|s=| |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  ÚerrnoÚEACCESr&   ÚextendÚlowerr   ÚENOENTÚfilenameÚlenr‘   Ústrip)rÖ   rð   r.  r  Úuser_option_partÚpermissions_partr5   r5   r6   rÕ     s>   



ýÿ

ÿ
þýüÿrÕ   )FNNFN)NNNF)Tr0  r¿   rÍ   rª   rþ   r%  Úoptparser   r   Útypingr   r   r   Úpip._vendor.packaging.utilsr   Úpip._vendor.richr   Úpip._internal.cacher	   Úpip._internal.clir
   Úpip._internal.cli.cmdoptionsr   Ú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   Ú(pip._internal.models.installation_reportr   Ú,pip._internal.operations.build.build_trackerr   Úpip._internal.operations.checkr   r   Úpip._internal.reqr   Úpip._internal.req.req_installr   Úpip._internal.utils.compatr   Ú"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'   Úpip._internal.wheel_builderr(   r)   r*   r  r§   r9   r:   r8   r  rË   r#  r©   r¶   rÔ   rÕ   r5   r5   r5   r6   Ú<module>   s¶    	    Mûÿþýüû
ú	ûÿþýüû
ú=ÿ
ÿ
þ'ÿÿÿþ