Your IP : 18.119.135.231


Current Path : /usr/lib64/python3.6/distutils/command/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/distutils/command/__pycache__/bdist_wininst.cpython-36.opt-2.pyc

3

�Qg�<�@slddlZddlZddlmZddlmZddlmZmZddl	Tddl
mZddlm
Z
Gdd	�d	e�ZdS)
�N)�Command)�get_platform)�create_tree�remove_tree)�*)�get_python_version)�logc@s�eZdZdZd5ddde�fd7d9d:d;d<d=d>d?d@dAdBg
ZddddgZejd&kZ	d'd(�Z
d)d*�Zd+d,�Zd-d.�Z
dCd/d0�Zd1d2�Zd3d4�ZdS)D�
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)�	keep-temp�kz/keep the pseudo-installation tree around after z!creating the distribution archive�target-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=�Ubasename of installation script to be run after installation 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 UAC�win32cCsRd|_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�r6�7/usr/lib64/python3.6/distutils/command/bdist_wininst.py�initialize_options=sz bdist_wininst.initialize_optionscCs�|jdd	�|jdkrR|jr6|jr6|jjd�}|j|_|jd�j}tj	j
|d�|_|js^d|_|jr�|jj�r�t
�}|jr�|j|kr�td|f��||_|jdd
d�|jr�x2|jjD]}|jtj	j|�kr�Pq�Wtd|j��dS)N�bdistr1Zwininst�zMtarget version can only be %s, or the '--skip-build' option must be specifiedr.r)z(install_script '%s' not found in scripts)r1r1)r.r.)r)r))Zset_undefined_optionsr(r1r)�distributionZget_command_obj�get_finalized_command�
bdist_base�os�path�joinr-�has_ext_modulesrZDistutilsOptionErrorr2�scripts�basename)r5r9r=Z
short_version�scriptr6r6r7�finalize_optionsMs4

zbdist_wininst.finalize_optionsc
Cs�tjdkr&|jj�s|jj�r&td��|js6|jd�|jddd�}|j	|_
|j|_d|_|j|_|jd�}d|_
d|_|jj�r�|j}|s�d	tjdd
�}d|j|f}|jd�}tjj|jd|�|_x4dD],}|j�}|dkr�|d}t|d||�q�Wtjd|j	�|j�tjjdtjj|j	d��|j�tjd=ddlm}|�}	|jj �}
|j!|	d|j	d�}|j"||
|j#�|jj��r�t$�}nd}|jj%j&d||j'|
�f�tj(d|�tj)|�|j*�s�t+|j	|j,d�dS)Nr'z^distribution contains extensions and/or C libraries; must be compiled on a Windows 32 platform�build�install�)Zreinit_subcommandsr�install_libz%d.%d�z.%s-%s�lib�purelib�platlib�headersrB�dataz/Include/$dist_nameZinstall_zinstalling to %sZPURELIB)�mktemp�zip)Zroot_dir�anyr	zremoving temporary file '%s')�dry_run)rLrMrNrBrO)-�sys�platformr;rAZhas_c_librariesZDistutilsPlatformErrorr1Zrun_commandZreinitialize_commandr(�rootZwarn_dirr)�compile�optimizer-�version_infor<r>r?r@Z
build_baseZ	build_lib�upper�setattrr�infoZensure_finalized�insert�runZtempfilerP�get_fullnameZmake_archive�
create_exer/rZ
dist_files�append�get_installer_filename�debug�remover*rrS)
r5rGrIr-Zplat_specifierrF�key�valuerPZarchive_basename�fullname�arcnameZ	pyversionr6r6r7r^ssd












zbdist_wininst.runcCs`g}|jj}|jd�|jpdd}dd�}xJdD]B}t||d�}|r2|d|j�||�f}|jd|||�f�q2W|jd�|jr�|jd|j�|jd||��|jd|j�|jd|j�|j	r�|jd|j	�|j
�r�|jd|j
�|j�p|jj�}|jd||��ddl
}ddl}	d|j|j
��|	jf}
|jd|
�dj|�S)Nz
[metadata]r:�
cSs|jdd�S)Nriz\n)�replace)�sr6r6r7�escape�sz)bdist_wininst.get_inidata.<locals>.escape�author�author_email�description�
maintainer�maintainer_email�name�url�versionz
    %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)rmrnrorprqrrrsrt)r;�metadataraZlong_description�getattr�
capitalizer2r+r,r-r4r0r_�time�	distutilsZctime�__version__r@)r5�linesrur\rlrrrOr0rxryZ
build_infor6r6r7�get_inidata�s<

zbdist_wininst.get_inidatac
Csddl}|j|j�|j�}|j|�}|jd|�|rPt|d�j�}t|�}nd}t|d�}	|	j	|j
��|rz|	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�mbcs��rzlatin-1)�encodings
z<iiii{V4)�structZmkpathr.r|rbZannounce�open�read�len�write�
get_exe_bytes�
isinstance�str�encoder3Zpack)
r5rhrgr/r�Zcfgdata�installer_nameZ
bitmapdataZ	bitmaplen�filerDZscript_data�headerr6r6r7r`�s:








zbdist_wininst.create_execCsD|jr&tjj|jd||j|jf�}ntjj|jd||jf�}|S)Nz%s.%s-py%s.exez	%s.%s.exe)r-r>r?r@r.r))r5rgr�r6r6r7rb's

z$bdist_wininst.get_installer_filenamec	Cs t�}|jrl|j|krl|jdkr&d}q�|jdkr6d}q�|jdkrFd}q�|jdkrVd}q�|jdkrfd	}q�d
}n@yddlm}Wntk
r�d
}YnX|jd
�d}|d}tjjt	�}|j
dkr�|j
dd�dkr�|j
dd�}nd}tjj|d||f�}t|d�}z|j
�S|j�XdS)Nz2.4z6.0z7.1z2.5z8.0z3.2z9.0z3.4z10.0z14.0r)�CRT_ASSEMBLY_VERSION�.z.0r'��winr:zwininst-%s%s.exer})rr-Zmsvcrtr��ImportError�	partitionr>r?�dirname�__file__r)r@r�r��close)	r5Zcur_versionZbvr��majorZ	directoryZsfix�filename�fr6r6r7r�4s8	






zbdist_wininst.get_exe_bytes)r
Nr�Pkeep the pseudo-installation tree around after creating the distribution archive)r
rr��6require a specific python version on the target system)rNr�)rrr)rrr)rrr)rrr)rrr)rNr )r!Nr")r#Nr$)r%Nr&)N)�__name__�
__module__�__qualname__rorZuser_optionsZboolean_optionsrTrUZ_unsupportedr8rEr^r|r`rbr�r6r6r6r7r	sP
&Q.
5
r	)rTr>Zdistutils.corerZdistutils.utilrZdistutils.dir_utilrrZdistutils.errorsZdistutils.sysconfigrryrr	r6r6r6r7�<module>s

?>