3
Ug>                 @   s  d 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jeZG dd deZee ee eddddZee ee ee ee ee e e eee ee
eee d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S )LegacyInstallFailureN)__name__
__module____qualname__ r   r   K/tmp/pip-unpacked-wheel-0ht26j5g/pip/_internal/operations/install/legacy.pyr      s   r   )record_linesrootreq_descriptionreturnc          
      s   t t d fdd}x>| D ]$}tjj|}|jdr||}P qW dj|}t|g }xD| D ]<}|j }	tjj|	r|	tjj	7 }	|j
tjj||	| q^W |j  t| tjj|d}
t|
d}|jdj|d  W d Q R X d S )	N)pathr   c                s(    d kst jj|  r| S t | S d S )N)osr   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
)strr   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   s(    


r3   )install_optionsglobal_optionsr   homeprefixuse_user_site	pycompileschemesetup_py_pathisolatedreq_name	build_envunpacked_source_directoryr   r   c          &   C   s   |j }tdd}ytjj|jd}t||| |||||||	|d}td|
 }t " | |||d W d Q R X W d Q R X tjj|st	j
d| dS W n( tk
r } zt|W Y d d }~X nX t|}|j j }W d Q R X W d Q R X t||| d	S )
Nrecord)kindzinstall-record.txt)
r5   r4   record_filenamer   r7   
header_dirr6   r8   no_user_configr9   z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
splitlinesr3   )r4   r5   r   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r   rC   temp_dirrB   install_argsrunnerer2   r   r   r   r   install>   s>    
 rR   )"__doc__loggingr   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   r   r3   boolrR   r   r   r   r   <module>   sB   
"