Your IP : 3.144.224.30


Current Path : /opt/alt/python34/lib64/python3.4/distutils/command/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/distutils/command/__pycache__/bdist_wininst.cpython-34.pyo

�
i f0:�@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/python34/lib64/python3.4/distutils/command/bdist_wininst.py�initialize_options:s												z bdist_wininst.initialize_optionscCs\|jdd	�|jdkr|jrR|jrR|jjd�}|j|_n|jd�j}tj	j
|d�|_n|js�d|_n|jr�|jj�r�t
�}|jr�|j|kr�td|f��n||_n|jdd
d�|jrXxI|jjD]%}|jtj	j|�krPqqWtd|j��ndS)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)�
skip_buildr8)�dist_dirr9)�	plat_namer:)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�tjdkr<|jj�s-|jj�r<td��n|jsU|jd�n|jddd�}|j	|_
|j|_d|_|j|_|jd�}d|_
d|_|jj�r0|j}|s�tjdd	�}nd
|j|f}|jd�}tjj|jd|�|_nxGdD]?}|j�}|dkrb|d}nt|d||�q7Wtjd|j	�|j�tjjdtjj|j	d��|j�tjd=ddlm}|�}	|jj �}
|j!|	dd|j	�}|j"||
|j#�|jj�rDt$�}nd}|jj%j&d||j'|
�f�tj(d|�tj)|�|j*s�t+|j	d|j,�ndS)N�win32z^distribution contains extensions and/or C libraries; must be compiled on a Windows 32 platform�build�installZreinit_subcommands�r�install_lib�z.%s-%s�lib�purelib�platlib�headersrB�dataz/Include/$dist_nameZinstall_zinstalling to %sZPURELIB)�mktemp�zipZroot_dir�anyr	zremoving temporary file '%s'�dry_run)zpurelibzplatlibrOzscriptszdata)-�sys�platformr;rAZhas_c_librariesZDistutilsPlatformErrorr.Zrun_commandZreinitialize_commandr%�rootZwarn_dirr&�compile�optimizer*�versionr<r>r?r@Z
build_baseZ	build_lib�upper�setattrr�infoZensure_finalized�insert�runZtempfilerQ�get_fullnameZmake_archive�
create_exer,rZ
dist_files�append�get_installer_filename�debug�remover'rrT)
r2rHrJr*Zplat_specifierrG�key�valuerQZarchive_basename�fullname�arcnameZ	pyversionr3r3r4r_psd					


%

	
	zbdist_wininst.runcCs�g}|jj}|jd�|jp+dd}dd�}x~dddd	d
ddd
gD]^}t||d�}|r]|d|j�||�f}|jd|||�f�q]q]W|jd�|jr�|jd|j�n|jd||��|jd|j�|jd|j�|j	rM|jd|j	�n|j
rm|jd|j
�n|jp�|jj�}|jd||��ddl
}ddl}	d|j|j
��|	jf}
|jd|
�dj|�S)Nz
[metadata]r7�
cSs|jdd�S)Nrjz\n)�replace)�sr3r3r4�escape�sz)bdist_wininst.get_inidata.<locals>.escapeZauthorZauthor_email�descriptionZ
maintainerZmaintainer_email�nameZurlrZz
    %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)r;�metadatarbZlong_description�getattr�
capitalizer/r(r)r*r1r-r`�time�	distutilsZctime�__version__r@)r2�linesrpr]rmrorPr-rsrtZ
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	|�nt|t�r�|j
d�}n|d}|jr+t|jddd	��}
|
j�j
d	�}WdQX||d
}n
|d}|	j	|�|jddt|�|�}|	j	|�|	j	t|d�j��dS)
Nrzcreating %s�rb�wb�mbcss�r�encodingzlatin-1s
z<iiii{V4)�structZmkpathr+rwrcZannounce�open�read�len�write�
get_exe_bytes�
isinstance�str�encoder0Zpack)
r2rirhr,r}Zcfgdata�installer_nameZ
bitmapdataZ	bitmaplen�filerDZscript_data�headerr3r3r4ra�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&)r2rhr�r3r3r4rc$s	z$bdist_wininst.get_installer_filenamec
Csddlm}t�}|jrm|j|krm|j|krL|�}qv|jdkrdd}qvd}n	|�}tjjt�}|jdkr�|jdd�dkr�|jdd�}nd	}tjj	|d
||f�}t
|d�}z|j�SWd|j�XdS)Nr)�get_build_versionz2.4g@gffffff@rFrK�winr7zwininst-%.1f%s.exerx)
Zdistutils.msvccompilerr�rr*r>r?�dirname�__file__r&r@r~r�close)r2r�Zcur_versionZbvZ	directoryZsfix�filename�fr3r3r4r�1s$					(zbdist_wininst.get_exe_bytes)r
Nr)rrr)rrr)rrr)rrr)rrr)rNr)rNr )r!Nr")r#Nr$)�__name__�
__module__�__qualname__rnrZuser_optionsZboolean_optionsr5rEr_rwrarcr�r3r3r3r4r	sN
			&Q.5
r	)�__doc__rUr>Zdistutils.corerZdistutils.utilrZdistutils.dir_utilrrZdistutils.errorsZdistutils.sysconfigrrtrr	r3r3r3r4�<module>s


?>