Your IP : 13.58.221.124


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

3

��2aJ<�@slddlZddlZddlmZddlmZddlmZmZddl	Tddl
mZddlm
Z
Gdd	�d	e�ZdS)
�N)�Command)�get_platform)�create_tree�remove_tree)�*)�get_python_version)�logc@s�eZdZdZd4ddde�fd6d8d9d:d;d<d=d>d?d@dAg
ZddddgZd&d'�Zd(d)�Zd*d+�Z	d,d-�Z
dBd.d/�Zd0d1�Zd2d3�Z
dS)C�
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 UACcCsRd|_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�r5�2/opt/alt/python36/lib64/python3.6/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�bdistr0Zwininst�zMtarget version can only be %s, or the '--skip-build' option must be specifiedr-r(z(install_script '%s' not found in scripts)r0r0)r-r-)r(r()Zset_undefined_optionsr'r0r(�distributionZget_command_obj�get_finalized_command�
bdist_base�os�path�joinr,�has_ext_modulesrZDistutilsOptionErrorr1�scripts�basename)r4r8r<Z
short_version�scriptr5r5r6�finalize_optionsJs4

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)N�win32z^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�headersrA�dataz/Include/$dist_nameZinstall_zinstalling to %sZPURELIB)�mktemp�zip)Zroot_dir�anyr	zremoving temporary file '%s')�dry_run)rLrMrNrArO)-�sys�platformr:r@Zhas_c_librariesZDistutilsPlatformErrorr0Zrun_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)
r4rGrIr,Zplat_specifierrF�key�valuerPZarchive_basename�fullname�arcnameZ	pyversionr5r5r6r^psd












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]r9�
cSs|jdd�S)Nriz\n)�replace)�sr5r5r6�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�
capitalizer1r*r+r,r3r/r_�time�	distutilsZctime�__version__r?)r4�linesrur\rlrrrOr/rxryZ
build_infor5r5r6�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�encoder2�pack)
r4rhrgr.r�Zcfgdata�installer_nameZ
bitmapdataZ	bitmaplen�filerCZscript_data�headerr5r5r6r`�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()r4rgr�r5r5r6rb$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.0rE��winr9zwininst-%s%s.exer})rr,Zmsvcrtr��ImportError�	partitionr=r>�dirname�__file__r(r?r�r��close)	r4Zcur_versionZbvr��majorZ	directoryZsfix�filename�fr5r5r6r�1s8	






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_optionsr7rDr^r|r`rbr�r5r5r5r6r	sN&Q.
5
r	)rTr=Zdistutils.corerZdistutils.utilrZdistutils.dir_utilrrZdistutils.errorsZdistutils.sysconfigrryrr	r5r5r5r6�<module>s

?>