509318396
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3
ct„j‡j  ã               @   s  d Z 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
 ddlm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ZddddddœZddddddœddddddœedœZe�rddddddœed < ddd!d"ddœed#< d+ZG d)d*„ d*eƒZdS ),zFdistutils.command.install

Implements the Distutils 'install' command.é    N)Úlog)ÚCommand)ÚDEBUG)Úget_config_vars)ÚDistutilsPlatformError)Ú
write_file)Úconvert_pathÚ
subst_varsÚchange_root)Úget_platform)ÚDistutilsOptionError)Ú	USER_BASE)Ú	USER_SITETz$base/Lib/site-packagesz$base/Include/$dist_namez$base/Scriptsz$base)ÚpurelibÚplatlibÚheadersÚscriptsÚdataz/$base/lib/python$py_version_short/site-packagesz5$platbase/lib64/python$py_version_short/site-packagesz9$base/include/python$py_version_short$abiflags/$dist_namez	$base/binz$base/lib/pythonz$base/lib64/pythonz$base/include/python/$dist_name)Úunix_prefixÚ	unix_homeÚntz	$usersitez4$userbase/Python$py_version_nodot/Include/$dist_namez)$userbase/Python$py_version_nodot/Scriptsz	$userbaseÚnt_userz=$userbase/include/python$py_version_short$abiflags/$dist_namez$userbase/binÚ	unix_userr   r   r   r   r   c               @   s:  e Zd ZdZd_d`dadbdddedfdgdidjdkdldmdndodpdqdrgZdd%d(gZer`ejd,dd-e fƒ ejd,ƒ d diZ	d.d/„ Z
d0d1„ Zd2d3„ Zd4d5„ Zd6d7„ Zd8d9„ Zd:d;„ Zd<d=„ Zd>d?„ Zd@dA„ ZdBdC„ ZdDdE„ ZdFdG„ ZdHdI„ ZdJdK„ ZdLdM„ ZdNdO„ ZdPdQ„ ZdRdS„ ZdTdU„ ZdVdW„ ZdXefdYefdZefd[efd\d]d^„ fgZdS )sÚinstallz'install everything from build directoryúprefix=Núinstallation prefixúexec-prefix=ú.(Unix only) prefix for platform-specific filesúhome=ú+(Unix only) home directory to install underúinstall-base=ú;base installation directory (instead of --prefix or --home)úinstall-platbase=z8base installation directory for platform-specific files z$(instead of --exec-prefix or --home)úroot=ú<install everything relative to this alternate root directoryúinstall-purelib=ú;installation directory for pure Python module distributionsúinstall-platlib=ú8installation directory for non-pure module distributionsúinstall-lib=z4installation directory for all module distributions z3(overrides --install-purelib and --install-platlib)úinstall-headers=ú(installation directory for C/C++ headersúinstall-scripts=ú)installation directory for Python scriptsúinstall-data=ú%installation directory for data filesÚcompileÚcúcompile .py to .pyc [default]ú
no-compileúdon't compile .py filesú	optimize=ÚOúlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]ÚforceÚfú1force installation (overwrite any existing files)ú
skip-buildú2skip rebuilding everything (for testing/debugging)úrecord=ú3filename in which to record list of installed filesÚuserz!install in user site-package '%s'c             C   sš   d| _ d| _d| _d| _d| _d| _d| _d| _d| _d| _	d| _
d| _d| _t| _t| _d| _d| _d| _d| _d| _d| _d| _d| _d| _d| _dS )zInitializes options.Nr   é   )ÚprefixÚexec_prefixÚhomer?   Úinstall_baseÚinstall_platbaseÚrootÚinstall_purelibÚinstall_platlibÚinstall_headersÚinstall_libÚinstall_scriptsÚinstall_datar   Úinstall_userbaser   Úinstall_usersiter0   ÚoptimizeÚ
extra_pathÚinstall_path_filer8   Ú
skip_buildÚwarn_dirÚ
build_baseÚ	build_libÚrecord)Úself© rX   ú1/usr/lib64/python3.6/distutils/command/install.pyÚinitialize_options’   s2    zinstall.initialize_optionsc             C   sx  | j s| js| jr&| js| jr&td%ƒ‚| jr@| j s8| jr@tdƒ‚| jrl| j sd| jsd| jsd| jsd| jrltdƒ‚tjdkrŒ| jrŒ| j	dƒ d| _| j
dƒ tjdkrª| jƒ  n| jƒ  | j
d	ƒ tjjƒ d
 }tddƒ\}}y
tj}W n tk
rú   d}Y nX | jjƒ | jjƒ | jjƒ |dtjdd…  dtjdd…  |||||dœ| _t�rf| j| jd< | j| jd< | jƒ  | j
dƒ | j| jd< | j| jd< t�r´d
dlm} tdƒ || jƒ | j ƒ  | j
dƒ | j�rÖ| j!ƒ  | j"dk�rþ| jj#�rö| j$| _"n| j%| _"| j&ddddddddƒ | j'ƒ  | j"| _(tj)j*| j"| j+ƒ| _"| j,dk	�r\| j-d ddddddƒ | j
d!ƒ | j.d"d&d'ƒ dS )(zFinalizes options.z.must supply either prefix/exec-prefix/home or z)install-base/install-platbase -- not bothz9must supply either home or prefix/exec-prefix -- not bothzGcan't combine user with prefix, exec_prefix/home, or install_(plat)baseÚposixz+exec-prefix option ignored on this platformNzpre-finalize_{unix,other}zpost-finalize_{unix,other}()r   rA   rB   Ú z%d.%dé   z%d%d)Z	dist_nameZdist_versionZdist_fullnameÚ
py_versionÚpy_version_shortÚpy_version_nodotZ
sys_prefixrA   Zsys_exec_prefixrB   ÚabiflagsÚuserbaseZusersitezpost-expand_basedirs()ÚbaseÚplatbase)Úpprintzconfig vars:zpost-expand_dirs()Úlibr   r   r   r   r   Zlibbasezafter prepending rootÚbuildrT   rU   zWmust supply either prefix/exec-prefix/home or install-base/install-platbase -- not both)rT   rT   )rU   rU   )/rA   rB   rC   rD   rE   r   r?   ÚosÚnameÚwarnÚ	dump_dirsÚfinalize_unixÚfinalize_otherÚsysÚversionÚsplitr   ra   ÚAttributeErrorÚdistributionZget_nameZget_versionZget_fullnameÚversion_infoÚconfig_varsÚHAS_USER_SITErM   rN   Úexpand_basedirsr   re   ÚprintÚexpand_dirsÚcreate_home_pathrJ   Zext_modulesrH   rG   Úconvert_pathsÚhandle_extra_pathÚinstall_libbaseÚpathÚjoinÚ
extra_dirsrF   Úchange_rootsZset_undefined_options)rW   r^   rA   rB   ra   re   rX   rX   rY   Úfinalize_optionsà   sŠ     

















zinstall.finalize_optionsc             C   s¤   t sdS ddlm} tj|d ƒ x|| jD ]r}|d }|d dkrN|dd	… }|| jkrz| j| }|j|ƒ}t| |ƒ }n|j|ƒ}t| |ƒ}tjd||ƒ q*W dS )
zDumps the list of user options.Nr   )Úlongopt_xlateú:r@   ú=z  %s: %séÿÿÿÿr…   )	r   Zdistutils.fancy_getoptr‚   r   ÚdebugÚuser_optionsÚnegative_optÚ	translateÚgetattr)rW   Úmsgr‚   ÚoptZopt_nameÚvalrX   rX   rY   rk   u  s    




zinstall.dump_dirsc             C   sX  | j dk	s| jdk	r\| jdkr2| jdkr2| jdksP| jdksP| jdksP| jdkrXtdƒ‚dS | j	rŽ| j
dkrttdƒ‚| j
 | _ | _| jdƒ nÆ| jdk	r²| j | _ | _| jdƒ n¢| jdk�r&| jdk	rÐtdƒ‚ttdƒpätjtjk rødtjkrød	}nd
}tjjtjƒ| | _tjjtjƒ| | _n| jdk�r:| j| _| j| _ | j| _| jdƒ dS )z&Finalizes options for posix platforms.NzPinstall-base or install-platbase supplied, but installation scheme is incompletez$User base directory is not specifiedr   r   z*must not supply exec-prefix without prefixZreal_prefixÚRPM_BUILD_ROOTz/localr\   r   )rD   rE   rJ   rG   rH   rI   rK   rL   r   r?   rM   r   Úselect_schemerC   rA   rB   Úhasattrrn   Úbase_prefixrh   Úenvironr}   Únormpath)rW   ZadditionrX   rX   rY   rl   ˆ  sF    










zinstall.finalize_unixc             C   s¼   | j r8| jdkrtdƒ‚| j | _| _| jtjd ƒ n€| jdk	r\| j | _| _| jdƒ n\| j	dkrvtj
jtj	ƒ| _	| j	 | _| _y| jtjƒ W n" tk
r¶   tdtj ƒ‚Y nX dS )z)Finalizes options for non-posix platformsNz$User base directory is not specifiedZ_userr   z)I don't know how to install stuff on '%s')r?   rM   r   rD   rE   r�   rh   ri   rC   rA   r}   r“   rn   ÚKeyError)rW   rX   rX   rY   rm   »  s"    


zinstall.finalize_otherc             C   s@   t | }x2tD ]*}d| }t| |ƒdkrt| ||| ƒ qW dS )z=Sets the install directories by applying the install schemes.Úinstall_N)ÚINSTALL_SCHEMESÚSCHEME_KEYSrŠ   Úsetattr)rW   ri   ÚschemeÚkeyZattrnamerX   rX   rY   r�   Ñ  s
    
zinstall.select_schemec             C   s\   xV|D ]N}t | |ƒ}|d k	rtjdks0tjdkr<tjj|ƒ}t|| jƒ}t| ||ƒ qW d S )Nr[   r   )rŠ   rh   ri   r}   Ú
expanduserr	   rt   r˜   )rW   ÚattrsÚattrr�   rX   rX   rY   Ú_expand_attrsÚ  s    

zinstall._expand_attrsc             C   s   | j dddgƒ dS )zNCalls `os.path.expanduser` on install_base, install_platbase and
        root.rD   rE   rF   N)rž   )rW   rX   rX   rY   rv   ã  s    zinstall.expand_basedirsc             C   s   | j ddddddgƒ dS )z+Calls `os.path.expanduser` on install dirs.rG   rH   rJ   rI   rK   rL   N)rž   )rW   rX   rX   rY   rx   è  s    zinstall.expand_dirsc             G   s0   x*|D ]"}d| }t | |tt| |ƒƒƒ qW dS )z!Call `convert_path` over `names`.r•   N)r˜   r   rŠ   )rW   Únamesri   r�   rX   rX   rY   rz   î  s    
zinstall.convert_pathsc             C   s¤   | j dkr| jj | _ | j dk	rŒtjdƒ t| j tƒrB| j jdƒ| _ t| j ƒdkr`| j d  }}n"t| j ƒdkrz| j \}}ntdƒ‚t	|ƒ}nd}d}|| _
|| _dS )	z4Set `path_file` and `extra_dirs` using `extra_path`.NzIDistribution option extra_path is deprecated. See issue27919 for details.ú,r@   r   r]   zY'extra_path' option must be a list, tuple, or comma-separated string with 1 or 2 elementsr\   )rP   rr   r   rj   Ú
isinstanceÚstrrp   Úlenr   r   Ú	path_filer   )rW   r¤   r   rX   rX   rY   r{   ô  s$    



zinstall.handle_extra_pathc          	   G   s4   x.|D ]&}d| }t | |t| jt| |ƒƒƒ qW dS )z:Change the install directories pointed by name using root.r•   N)r˜   r
   rF   rŠ   )rW   rŸ   ri   r�   rX   rX   rY   r€     s    
zinstall.change_rootsc             C   sh   | j s
dS ttjjdƒƒ}xH| jjƒ D ]:\}}|j|ƒr&tjj|ƒ r&| j	d| ƒ tj
|dƒ q&W dS )zCreate directories under ~.Nú~zos.makedirs('%s', 0o700)iÀ  )r?   r   rh   r}   r›   rt   ÚitemsÚ
startswithÚisdirZdebug_printÚmakedirs)rW   rC   ri   r}   rX   rX   rY   ry     s    zinstall.create_home_pathc             C   s,  | j s6| jdƒ | jjdƒj}| jr6|tƒ kr6tdƒ‚x| jƒ D ]}| j|ƒ q@W | j	r`| j
ƒ  | jrÂ| jƒ }| jr¨t| jƒ}x(tt|ƒƒD ]}|| |d… ||< qŒW | jt| j|fd| j ƒ ttjjtjƒ}ttjj|ƒ}tjjtjj| jƒƒ}| j�r(| j	�o
| j �r(||k�r(tjd| jƒ dS )zRuns the command.rg   z"Can't install when cross-compilingNz'writing list of installed files to '%s'zƒmodules installed to '%s', which is not in Python's module search path (sys.path) -- you'll have to change the search path yourself)rR   Zrun_commandrr   Zget_command_objZ	plat_namerS   r   r   Úget_sub_commandsr¤   Úcreate_path_filerV   Úget_outputsrF   r£   ÚrangeÚexecuter   Úmaprh   r}   r“   rn   ÚnormcaserJ   rQ   r   r†   )rW   Z
build_platÚcmd_nameÚoutputsZroot_lenZcounterZsys_pathrJ   rX   rX   rY   Úrun(  s6    



zinstall.runc             C   sJ   t jj| j| jd ƒ}| jr8| jt|| jgfd| ƒ n| j	d| ƒ dS )zCreates the .pth filez.pthzcreating %szpath file '%s' not createdN)
rh   r}   r~   r|   r¤   rQ   r®   r   r   rj   )rW   ÚfilenamerX   rX   rY   r«   T  s    

zinstall.create_path_filec             C   sp   g }x>| j ƒ D ]2}| j|ƒ}x"|jƒ D ]}||kr&|j|ƒ q&W qW | jrl| jrl|jtjj| j	| jd ƒƒ |S )z.Assembles the outputs of all the sub-commands.z.pth)
rª   Úget_finalized_commandr¬   Úappendr¤   rQ   rh   r}   r~   r|   )rW   r²   r±   Úcmdr´   rX   rX   rY   r¬   b  s    
zinstall.get_outputsc             C   s2   g }x(| j ƒ D ]}| j|ƒ}|j|jƒ ƒ qW |S )z*Returns the inputs of all the sub-commands)rª   rµ   ÚextendÚ
get_inputs)rW   Zinputsr±   r·   rX   rX   rY   r¹   s  s
    
zinstall.get_inputsc             C   s   | j jƒ p| j jƒ S )zSReturns true if the current distribution has any Python
        modules to install.)rr   Zhas_pure_modulesZhas_ext_modules)rW   rX   rX   rY   Úhas_lib  s    
zinstall.has_libc             C   s
   | j jƒ S )zLReturns true if the current distribution has any headers to
        install.)rr   Úhas_headers)rW   rX   rX   rY   r»   …  s    zinstall.has_headersc             C   s
   | j jƒ S )zMReturns true if the current distribution has any scripts to.
        install.)rr   Úhas_scripts)rW   rX   rX   rY   r¼   Š  s    zinstall.has_scriptsc             C   s
   | j jƒ S )zJReturns true if the current distribution has any data to.
        install.)rr   Zhas_data_files)rW   rX   rX   rY   Úhas_data�  s    zinstall.has_datarJ   rI   rK   rL   Zinstall_egg_infoc             C   s   dS )NTrX   )rW   rX   rX   rY   Ú<lambda>š  s    zinstall.<lambda>)r   Nr   )r   Nr   )r   Nr   )r    Nr!   ú\base installation directory for platform-specific files (instead of --exec-prefix or --home))r"   Nr¿   )r#   Nr$   )r%   Nr&   )r'   Nr(   úginstallation directory for all module distributions (overrides --install-purelib and --install-platlib))r)   NrÀ   )r*   Nr+   )r,   Nr-   )r.   Nr/   )r0   r1   r2   )r3   Nr4   )r5   r6   r7   )r8   r9   r:   )r;   Nr<   )r=   Nr>   ) Ú__name__Ú
__module__Ú__qualname__Zdescriptionr‡   Zboolean_optionsru   r¶   r   rˆ   rZ   r�   rk   rl   rm   r�   rž   rv   rx   rz   r{   r€   ry   r³   r«   r¬   r¹   rº   r»   r¼   r½   Zsub_commandsrX   rX   rX   rY   r   I   sŒ                     

N 3		",r   )r   r   r   r   r   )Ú__doc__rn   rh   Z	distutilsr   Zdistutils.corer   Zdistutils.debugr   Zdistutils.sysconfigr   Zdistutils.errorsr   Zdistutils.file_utilr   Zdistutils.utilr   r	   r
   r   r   Zsiter   r   ru   ZWINDOWS_SCHEMEr–   r—   r   rX   rX   rX   rY   Ú<module>   sV   