???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................3
ij                 @   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=Olalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]forcef1force installation (overwrite any existing files)
skip-build2skip 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rd
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: %sr   )	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	rtdttdptjtjk rdtjkrd	}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	rt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rt| j}x(tt|D ]}|| |d ||< qW | 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'zmodules 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   