Your IP : 18.222.161.119


Current Path : /opt/alt/python35/lib64/python3.5/distutils/command/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/distutils/command/__pycache__/bdist_wininst.cpython-35.pyc



��Yf�;�@s�dZddlZddlZddlmZddlmZddlmZm	Z	ddl
TddlmZddl
mZGd	d
�d
e�ZdS)zzdistutils.command.bdist_wininst

Implements the Distutils 'bdist_wininst' command: create a windows installer
exe-program.�N)�Command)�get_platform)�create_tree�remove_tree)�*)�get_python_version)�logc@s�eZdZdZd4ddde�fdd	d
dfddd
dfd5d6d7d8d9d:d;d<d=g
ZddddgZd&d'�Zd(d)�Zd*d+�Z	d,d-�Z
dd.d/�Zd0d1�Zd2d3�Z
dS)>�
bdist_wininstz-create an executable installer for MS Windows�
bdist-dir=N�1temporary directory for creating the distributionz
plat-name=�pz;platform name to embed in generated filenames (default: %s)z	keep-temp�kz/keep the pseudo-installation tree around after z!creating the distribution archiveztarget-version=z!require a specific python versionz on the target system�no-target-compile�c�/do not compile .py to .pyc on the target system�no-target-optimize�o�:do not compile .py to .pyo (optimized)on the target system�	dist-dir=�d�-directory to put final built distributions in�bitmap=�b�>bitmap to use for the installer instead of python-powered logo�title=�t�?title to display on the installer background instead of default�
skip-build�2skip rebuilding everything (for testing/debugging)�install-script=�Tbasename of installation script to be run afterinstallation or before deinstallation�pre-install-script=�{Fully qualified filename of a script to be run before any files are installed.  This script need not be in the distribution�user-access-control=��specify Vista's UAC handling - 'none'/default=no handling, 'auto'=use UAC if target Python installed for all users, 'force'=always use UACcCsyd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_dS)Nr)
�	bdist_dir�	plat_name�	keep_temp�no_target_compile�no_target_optimize�target_version�dist_dir�bitmap�title�
skip_build�install_script�pre_install_script�user_access_control)�self�r3�D/opt/alt/python35/lib64/python3.5/distutils/command/bdist_wininst.py�initialize_options:s												z bdist_wininst.initialize_optionscCsG|jdd	�|jdkry|jrO|jrO|jjd�}|j|_|jd�j}tj	j
|d�|_|js�d|_|jr�|jj�r�t
�}|jr�|j|kr�td|f��||_|jdd
d�|jrCxC|jjD]"}|jtj	j|�kr
Pq
Wtd|j��dS)N�bdistr.Zwininst�zMtarget version can only be %s, or the '--skip-build' option must be specifiedr+r&z(install_script '%s' not found in scripts)r.r.)r+r+)r&r&)Zset_undefined_optionsr%r.r&�distributionZget_command_obj�get_finalized_command�
bdist_base�os�path�joinr*�has_ext_modulesrZDistutilsOptionErrorr/�scripts�basename)r2r6r:Z
short_version�scriptr3r3r4�finalize_optionsJs4			
			zbdist_wininst.finalize_optionsc
Cs�tjdkr9|jj�s-|jj�r9td��|jsO|jd�|jddd�}|j	|_
|j|_d|_|j|_|jd�}d|_
d|_|jj�r9|j}|s�|js�td	��tjdd
�}d|j|f}|jd�}tjj|jd|�|_xDdD]<}|j�}|dkrh|d}t|d||�q@Wtjd|j	�|j�tjjdtjj|j	d��|j�tjd=ddlm }|�}	|jj!�}
|j"|	dd|j	�}|j#||
|j$�|jj�rJt%�}nd}|jj&j'd||j(|
�f�tj)d|�tj*|�|j+s�t,|j	d|j-�dS)N�win32z^distribution contains extensions and/or C libraries; must be compiled on a Windows 32 platform�build�installZreinit_subcommands�r�install_libz Should have already checked this�z.%s-%s�lib�purelib�platlib�headersr?�dataz/Include/$dist_nameZinstall_zinstalling to %sZPURELIB)�mktemp�zipZroot_dir�anyr	zremoving temporary file '%s'�dry_run)rJrKrLr?rM).�sys�platformr8r>Zhas_c_librariesZDistutilsPlatformErrorr.Zrun_commandZreinitialize_commandr%�rootZwarn_dirr&�compile�optimizer*�AssertionError�versionr9r;r<r=Z
build_baseZ	build_lib�upper�setattrr�infoZensure_finalized�insert�runZtempfilerN�get_fullnameZmake_archive�
create_exer,rZ
dist_files�append�get_installer_filename�debug�remover'rrQ)
r2rErGr*Zplat_specifierrD�key�valuerNZarchive_basename�fullname�arcnameZ	pyversionr3r3r4r]psf		
				


%

	
	zbdist_wininst.runcCs�g}|jj}|jd�|jp+dd}dd�}x{dddd	d
ddd
gD][}t||d�}|r]|d|j�||�f}|jd|||�f�q]W|jd�|jr�|jd|j�|jd||��|jd|j�|jd|j�|j	rD|jd|j	�|j
ra|jd|j
�|jpv|jj�}|jd||��ddl
}ddl}	d|j|j
��|	jf}
|jd|
�dj|�S)Nz
[metadata]r7�
cSs|jdd�S)Nrhz\n)�replace)�sr3r3r4�escape�sz)bdist_wininst.get_inidata.<locals>.escapeZauthorZauthor_email�descriptionZ
maintainerZmaintainer_email�nameZurlrXz
    %s: %sz%s=%sz
[Setup]zinstall_script=%szinfo=%sztarget_compile=%dztarget_optimize=%dztarget_version=%szuser_access_control=%sztitle=%srzBuilt %s with distutils-%sz
build_info=%s)r8�metadatar`Zlong_description�getattr�
capitalizer/r(r)r*r1r-r^�time�	distutilsZctime�__version__r=)r2�linesrnr[rkrmrMr-rqrrZ
build_infor3r3r4�get_inidata�s<
!
			zbdist_wininst.get_inidatac
Cs�ddl}|j|j�|j�}|j|�}|jd|�|rrt|d�j�}t|�}nd}t|d�}	|	j	|j
��|r�|	j	|�t|t�r�|j
d�}|d}|jr&t|jddd	��}
|
j�j
d	�}WdQRX||d
}n
|d}|	j	|�|jddt|�|�}|	j	|�|	j	t|d�j��dS)
Nrzcreating %s�rb�wb�mbcss�r�encodingzlatin-1s
z<iiii{V4)�structZmkpathr+ruraZannounce�open�read�len�write�
get_exe_bytes�
isinstance�str�encoder0Zpack)
r2rgrfr,r{Zcfgdata�installer_nameZ
bitmapdataZ	bitmaplen�filerAZscript_data�headerr3r3r4r_�s:

	

			
zbdist_wininst.create_execCs`|jr7tjj|jd||j|jf�}n%tjj|jd||jf�}|S)Nz%s.%s-py%s.exez	%s.%s.exe)r*r;r<r=r+r&)r2rfr�r3r3r4ra$s	z$bdist_wininst.get_installer_filenamecCs�t�}|jr�|j|kr�|jdkr9d}q�|jdkrQd}q�|jdkrid}q�|jdkr�d}q�|jdkr�d	}q�d
}nZyddlm}Wntk
r�d
}Yn,Xtd
j|jd
d�dd���}tj	j
t�}|jdkrL|jdd�dkrL|jdd�}nd}tj	j|d||f�}t
|d�}z|j�SWd|j�XdS)Nz2.4g@gffffff@z2.5g @z3.2g"@z3.4g$@g,@r)�CRT_ASSEMBLY_VERSION�.�rCrH�winr7zwininst-%.1f%s.exerv)rr*Zmsvcrtr��ImportError�floatr=�splitr;r<�dirname�__file__r&r|r}�close)r2Zcur_versionZbvr�Z	directoryZsfix�filename�fr3r3r4r�1s6								
+(zbdist_wininst.get_exe_bytes)r
Nr)rrr)rrr)rrr)rrr)rrr)rNr)rNr )r!Nr")r#Nr$)�__name__�
__module__�__qualname__rlrZuser_optionsZboolean_optionsr5rBr]rur_rar�r3r3r3r4r	sN
			&Q.5
r	)�__doc__rRr;Zdistutils.corerZdistutils.utilrZdistutils.dir_utilrrZdistutils.errorsZdistutils.sysconfigrrrrr	r3r3r3r4�<module>s


?>