Your IP : 216.73.216.213


Current Path : /opt/alt/python33/lib64/python3.3/Tools/freeze/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/Tools/freeze/__pycache__/checkextensions_win32.cpython-33.pyc

�
��f9c@s�dZddlZddlZyddlZWnek
rHdZYnXGdd�d�Zdd�Zdd�Zd	d
�Z	dd�Z
d
ZdZdZ
dZdS(u�Extension management for Windows.

Under Windows it is unlikely the .obj files are of use, as special compiler options
are needed (primarily to toggle the behavior of "public" symbols.

I don't consider it worth parsing the MSVC makefiles for compiler options.  Even if
we get it just right, a specific freeze application may have specific compiler
options anyway (eg, to enable or disable specific functionality)

So my basic strategy is:

* Have some Windows INI files which "describe" one or more extension modules.
  (Freeze comes with a default one for all known modules - but you can specify
  your own).
* This description can include:
  - The MSVC .dsp file for the extension.  The .c source file names
    are extracted from there.
  - Specific compiler/linker options
  - Flag to indicate if Unicode compilation is expected.

At the moment the name and location of this INI file is hardcoded,
but an obvious enhancement would be to provide command line options.
iNcBsb|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS(u
CExtensionu8An abstraction of an extension implemented in C/C++
    cCs(||_||_g|_g|_dS(N(unameusourceFilesucompilerOptionsu
linkerLibs(uselfunameusourceFiles((uG/opt/alt/python33/lib64/python3.3/Tools/freeze/checkextensions_win32.pyu__init__"s			uCExtension.__init__cCs|jS(N(usourceFiles(uself((uG/opt/alt/python33/lib64/python3.3/Tools/freeze/checkextensions_win32.pyuGetSourceFiles,suCExtension.GetSourceFilescCs|jj|�dS(N(ucompilerOptionsuappend(uselfuoption((uG/opt/alt/python33/lib64/python3.3/Tools/freeze/checkextensions_win32.pyuAddCompilerOption/suCExtension.AddCompilerOptioncCs|jS(N(ucompilerOptions(uself((uG/opt/alt/python33/lib64/python3.3/Tools/freeze/checkextensions_win32.pyuGetCompilerOptions1suCExtension.GetCompilerOptionscCs|jj|�dS(N(u
linkerLibsuappend(uselfulib((uG/opt/alt/python33/lib64/python3.3/Tools/freeze/checkextensions_win32.pyuAddLinkerLib4suCExtension.AddLinkerLibcCs|jS(N(u
linkerLibs(uself((uG/opt/alt/python33/lib64/python3.3/Tools/freeze/checkextensions_win32.pyu
GetLinkerLibs6suCExtension.GetLinkerLibsN(
u__name__u
__module__u__qualname__u__doc__u__init__uGetSourceFilesuAddCompilerOptionuGetCompilerOptionsuAddLinkerLibu
GetLinkerLibs(u
__locals__((uG/opt/alt/python33/lib64/python3.3/Tools/freeze/checkextensions_win32.pyu
CExtensions
u
CExtensioncCs�tjjtjjtjd�dd�}tjj|�sUtjjd|�n
|j	|�g}xb|D]Z}xQ|D]5}t
|||�}|dk	r||j	|�Pq|q|Wtjjd|�qoW|S(Niuextensions_win32.iniuDWARNING: %s can not be found - standard extensions may not be found
u6No definition of module %s in any specified map file.
(uosupathujoinusplitusysuargvuisfileustderruwriteuappenduget_extension_defnuNone(uunknownu
extra_inisuprefixudefaultMapNameuretumoduiniudefn((uG/opt/alt/python33/lib64/python3.3/Tools/freeze/checkextensions_win32.pyucheckextensions9s,



ucheckextensionscCs�tdkrdS|tjd<tj|dd|�}|dkrEdStj|�}tjj|�s�tjjtjj	|�d|�}nt
|�}|dkr�dSt||�}tjj	|�dtjd<tjj	|�dtjd<tj|dd|�}|r*|jtj|��ntj|dd|�}|j	�}tj|d	d|�rv|jd
�ntj|dd|�j	�}x$|D]}	|j
tj|	��q�Wx0|D](}
|
|jkr�tjj|
�q�q�W|S(NuPYTHONPREFIXudspuiudsp_pathuini_pathucluexcludeuUnicodeu/D UNICODE /D _UNICODEulibs(uwin32apiuNoneuosuenvironu
GetProfileValuExpandEnvironmentStringsupathuisabsujoinusplitu	parse_dspu
CExtensionuAddCompilerOptionuAddLinkerLibusourceFilesumodulesuremove(u
moduleNameumapFileNameuprefixudspusourceFilesumoduleu
cl_optionsuexcludeulibsulibuexc((uG/opt/alt/python33/lib64/python3.3/Tools/freeze/checkextensions_win32.pyuget_extension_defnRs:
(

uget_extension_defncCsg}tjj|�\}}yt|d�j�}WnCtk
r|}z#tjjd||f�dSWYdd}~XnXx�|D]�}|j
�jdd�}|ddkr�tjj|d�dj�d
kr|j
tjtjj||d���qq�q�W|S(Nuru%s: %s
u=iiuSOURCEiu.cppu.c(u.cppu.c(uosupathusplituopenu	readlinesuIOErrorusysustderruwriteuNoneustripusplitextuloweruappenduwin32apiuGetFullPathNameujoin(udspuretudsp_pathudsp_nameulinesumsgulineufields((uG/opt/alt/python33/lib64/python3.3/Tools/freeze/checkextensions_win32.pyu	parse_dsps
&3u	parse_dspcCs�t|d�}z�|jt�x5|D]-}|jjd�d}|jd|�q&W|jt�x;|D]3}|jjd�d}|jd||f�qkW|jt�|jt�Wd|j�XdS(Nuwu.iuextern void init%s(void);
u	{"%s", init%s},
i����i����(	uopenuwriteuext_src_headerunameusplituext_tab_headeruext_tab_footeruext_src_footeruclose(ufnameumodulesufpumoduleuname((uG/opt/alt/python33/lib64/python3.3/Tools/freeze/checkextensions_win32.pyuwrite_extension_table�s




uwrite_extension_tableu#include "Python.h"
u)
static struct _inittab extensions[] = {
u)        /* Sentinel */
        {0, 0}
};
u�extern DL_IMPORT(int) PyImport_ExtendInittab(struct _inittab *newtab);

int PyInitFrozenExtensions()
{
        return PyImport_ExtendInittab(extensions);
}

(u__doc__uosusysuwin32apiuImportErroruNoneu
CExtensionucheckextensionsuget_extension_defnu	parse_dspuwrite_extension_tableuext_src_headeruext_tab_headeruext_tab_footeruext_src_footer(((uG/opt/alt/python33/lib64/python3.3/Tools/freeze/checkextensions_win32.pyu<module>s
-