o
    |ŸŽi¹  ã                   @   sä   d Z ddlZddlZddlZddl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 ddlmZ ddlmZ e e¡ZG dd„ deƒZdee dee deddfdd„Z dd„ Z!dS )z6Legacy installation process, i.e. `setup.py install`.
é    N)Úchange_root)ÚListÚOptionalÚSequence)ÚBuildEnvironment)ÚInstallationError)ÚScheme)Ú
indent_log)Ú
ensure_dir)Úmake_setuptools_install_args)Úrunner_with_spinner_message)ÚTempDirectoryc                   @   s   e Zd Zdd„ ZdS )ÚLegacyInstallFailurec                 C   s   t  ¡ | _d S ©N)ÚsysÚexc_infoÚparent)Úself© r   úqC:\Users\psant\Downloads\Anu Raj Backend\school\venv\Lib\site-packages\pip/_internal/operations/install/legacy.pyÚ__init__   s   zLegacyInstallFailure.__init__N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r      s    r   Úrecord_linesÚrootÚreq_descriptionÚreturnc                    sò   ‡ fdd„}| D ]}t j |¡}| d¡r||ƒ} q%qd |¡}t|ƒ‚g }| D ]}| ¡ }	t j |	¡r;|	t jj7 }	| 	t j 
||	ƒ|¡¡ q)| ¡  t|ƒ t j |d¡}
t|
dƒ�}| d |¡d ¡ W d   ƒ d S 1 srw   Y  d S )Nc                    s"   ˆ d u s
t j | ¡s| S tˆ | ƒS r   )ÚosÚpathÚisabsr   )r   ©r   r   r   Úprepend_root!   s   
zBwrite_installed_files_from_setuptools_record.<locals>.prepend_rootz	.egg-infoz„{} did not indicate that it installed an .egg-info directory. Only setup.py projects generating .egg-info directories are supported.zinstalled-files.txtÚwÚ
)r   r   ÚdirnameÚendswithÚformatr   ÚstripÚisdirÚsepÚappendÚrelpathÚsortr
   ÚjoinÚopenÚwrite)r   r   r   r"   ÚlineÚ	directoryÚegg_info_dirÚmessageÚ	new_linesÚfilenameÚinst_files_pathÚfr   r!   r   Ú,write_installed_files_from_setuptools_record   s2   
þüÿ"ÿr9   c                 C   sH  |j }tdd��Œ}z`tj |jd¡}t||| |||||||	|d�}td|
› �ƒ}tƒ �  |� |||d� W d   ƒ n1 s?w   Y  W d   ƒ n1 sNw   Y  tj |¡sht	 
d|¡ W W d   ƒ dS W n	 tyr   t‚w t|ƒ�}| ¡  ¡ }W d   ƒ n1 sˆw   Y  W d   ƒ n1 s—w   Y  t|||ƒ d	S )
NÚrecord)Úkindzinstall-record.txt)
Úglobal_optionsÚinstall_optionsÚrecord_filenamer   ÚprefixÚ
header_dirÚhomeÚuse_user_siteÚno_user_configÚ	pycompilezRunning setup.py install for )ÚcmdÚcwdzRecord file %s not foundFT)Úheadersr   r   r   r.   r   r   r	   ÚexistsÚloggerÚdebugÚ	Exceptionr   r/   ÚreadÚ
splitlinesr9   )r=   r<   r   rA   r?   rB   rD   ÚschemeÚsetup_py_pathÚisolatedÚreq_nameÚ	build_envÚunpacked_source_directoryr   r@   Útemp_dirr>   Úinstall_argsÚrunnerr8   r   r   r   r   ÚinstallD   sV   õÿþÿ€ ãþ
	ÿ€Ø+rW   )"Ú__doc__Úloggingr   r   Údistutils.utilr   Útypingr   r   r   Úpip._internal.build_envr   Úpip._internal.exceptionsr   Úpip._internal.models.schemer   Úpip._internal.utils.loggingr	   Úpip._internal.utils.miscr
   Ú$pip._internal.utils.setuptools_buildr   Úpip._internal.utils.subprocessr   Úpip._internal.utils.temp_dirr   Ú	getLoggerr   rI   rK   r   Ústrr9   rW   r   r   r   r   Ú<module>   s4    
ÿþý
ü(