B
    ²>[‚ ã            [   @   s  d dl Z d dlZd dlZd dlZd dlZdddddddddd	d d
dddddddœZddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d dddddd!ddd"ddd#dddd$d%dd&d'd(œZZg aG d)d*„ d*eƒZ	G d+d,„ d,ƒZ
G d-d.„ d.ƒZG d/d0„ d0ƒZG d1d2„ d2eƒZG d3d4„ d4eƒZG d5d6„ d6eƒZG d7d8„ d8eƒZG d9d:„ d:eƒZd;d<„ ZdWd>d?„Zd@dA„ ZdXdBdC„ZdYdDdE„ZdZdFdG„ZdHdI„ ZdJdK„ ZdLdM„ Zd[dOdP„Zd\dQdR„ZdSdT„ Zd]dUdV„ZdS )^é    NÚ a  /opt/conda/conda-bld/sip_1530793372778/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bina  /opt/conda/conda-bld/sip_1530793372778/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/lib/python3.7/site-packagesa	  /opt/conda/conda-bld/sip_1530793372778/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/share/sipz	linux-g++a  /opt/conda/conda-bld/sip_1530793372778/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/include/python3.7ma  /opt/conda/conda-bld/sip_1530793372778/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/lib/python3.7/configi  a  /opt/conda/conda-bld/sip_1530793372778/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/sipa	  --sysroot=/opt/conda/conda-bld/sip_1530793372778/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeholdi z4.19.8)ÚarchÚdefault_bin_dirÚdefault_mod_dirZdefault_sip_dirÚdeployment_targetÚplatformÚpy_conf_inc_dirÚ
py_inc_dirÚ
py_lib_dirÚ
py_versionÚqt_frameworkZsip_binZsip_config_argsÚsip_inc_dirZsip_mod_dirZsip_versionZsip_version_strÚ	universalzar cqsZgccz-pipez-gz-O2z-fPICz-D_REENTRANTz-wz-Wall -Wztest -dz'qt warn_on release incremental link_prlzcp -fzg++zrm -fz/usr/X11R6/includez-sharedz-Wl,-soname,z/usr/X11R6/libz
-lGLU -lGLz	-lpthreadz-lXext -lX11 -lmÚUNIXzmkdir -pz-Wl,-rpath,Ústrip)ZÚ	AIX_SHLIBÚARÚCCÚCFLAGSZ
CFLAGS_APPÚCFLAGS_CONSOLEÚCFLAGS_DEBUGÚCFLAGS_EXCEPTIONS_OFFÚCFLAGS_EXCEPTIONS_ONÚ	CFLAGS_MTÚCFLAGS_MT_DBGÚCFLAGS_MT_DLLÚCFLAGS_MT_DLLDBGÚCFLAGS_RELEASEÚCFLAGS_RTTI_OFFÚCFLAGS_RTTI_ONÚCFLAGS_SHLIBÚCFLAGS_STL_OFFÚCFLAGS_STL_ONÚCFLAGS_THREADÚCFLAGS_WARN_OFFÚCFLAGS_WARN_ONÚCHK_DIR_EXISTSÚCONFIGÚCOPYÚCXXÚCXXFLAGSÚCXXFLAGS_APPÚCXXFLAGS_CONSOLEÚCXXFLAGS_DEBUGÚCXXFLAGS_EXCEPTIONS_OFFÚCXXFLAGS_EXCEPTIONS_ONÚCXXFLAGS_MTÚCXXFLAGS_MT_DBGÚCXXFLAGS_MT_DLLÚCXXFLAGS_MT_DLLDBGÚCXXFLAGS_RELEASEÚCXXFLAGS_RTTI_OFFÚCXXFLAGS_RTTI_ONÚCXXFLAGS_SHLIBÚCXXFLAGS_STL_OFFÚCXXFLAGS_STL_ONÚCXXFLAGS_THREADÚCXXFLAGS_WARN_OFFÚCXXFLAGS_WARN_ONÚDEFINESÚDEL_FILEÚEXTENSION_PLUGINÚEXTENSION_SHLIBÚINCDIRÚINCDIR_OPENGLÚ
INCDIR_X11ÚLFLAGSÚLFLAGS_CONSOLEÚLFLAGS_CONSOLE_DLLÚLFLAGS_DEBUGÚ
LFLAGS_DLLÚLFLAGS_OPENGLÚLFLAGS_PLUGINÚLFLAGS_RELEASEÚLFLAGS_RPATHÚLFLAGS_SHLIBZLFLAGS_SONAMEÚLFLAGS_THREADÚLFLAGS_WINDOWSÚLFLAGS_WINDOWS_DLLÚLIBÚLIBDIRÚLIBDIR_OPENGLÚ
LIBDIR_X11ÚLIBSÚLIBS_CONSOLEÚ	LIBS_COREÚLIBS_GUIÚLIBS_NETWORKÚLIBS_OPENGLÚLIBS_RTÚ	LIBS_RTMTÚLIBS_THREADÚLIBS_WEBKITÚLIBS_WINDOWSÚLIBS_X11ÚLINKÚ
LINK_SHLIBZLINK_SHLIB_CMDÚMAKEFILE_GENERATORÚMKDIRÚRANLIBÚRPATHÚSTRIPc               @   s2   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ ZdS )ÚConfigurationz8The class that represents SIP configuration values.
    Nc             C   sb   d| _ x:| jjD ].}|tkrqtj|j }t|dƒr|j| _ P qW |rL|}ng }| 	t
¡ |adS )z˜Initialise an instance of the class.

        sub_cfg is the list of sub-class configurations.  It should be None
        when called normally.
        NÚ_default_macros)Ú_macrosÚ	__class__Ú__mro__ÚobjectÚsysÚmodulesÚ
__module__Úhasattrri   ÚappendÚ_pkg_configÚ_config_stack)ÚselfZsub_cfgÚclsÚmodÚcfg© ry   ú(lib/python3.7/site-packages/sipconfig.pyÚ__init__•   s    

zConfiguration.__init__c          	   C   s<   x*t D ]"}y|| S  tk
r&   Y qX qW td| ƒ‚dS )z¦Allow configuration values and user options to be handled as
        instance variables.

        name is the name of the configuration value or user option.
        z6"%s" is not a valid configuration value or user optionN)rt   ÚKeyErrorÚAttributeError)ru   Únamerx   ry   ry   rz   Ú__getattr__³   s    

zConfiguration.__getattr__c             C   s   | j S )zAReturn the dictionary of platform specific build macros.
        )rj   )ru   ry   ry   rz   Úbuild_macrosÁ   s    zConfiguration.build_macrosc             C   s
   || _ dS )zSet the dictionary of build macros to be use when generating
        Makefiles.

        macros is the dictionary of platform specific build macros.
        N)rj   )ru   Úmacrosry   ry   rz   Úset_build_macrosÆ   s    zConfiguration.set_build_macros)N)Ú__name__rp   Ú__qualname__Ú__doc__r{   r   r€   r‚   ry   ry   ry   rz   rh   ’   s
   
rh   c               @   s:   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ Zdd„ ZdS )Ú_UniqueListz=A limited list that ensures all its elements are unique.
    Nc             C   s   |dkrg | _ n|| _ dS )zRInitialise the instance.

        value is the initial value of the list.
        N)Ú_list)ru   Úvaluery   ry   rz   r{   Ò   s    z_UniqueList.__init__c             C   s   || j kr| j  |¡ dS )zgAppend a value to the list if it isn't already present.

        value is the value to append.
        N)r‡   rr   )ru   rˆ   ry   ry   rz   rr   Ü   s    
z_UniqueList.appendc             C   s   | j  |¡ dS )zhA normal list extend ignoring the uniqueness.

        value is the list of elements to append.
        N)r‡   Úextend)ru   rˆ   ry   ry   rz   Úlextendä   s    z_UniqueList.lextendc             C   s   x|D ]}|   |¡ qW dS )zˆAppend each element of a value to a list if it isn't already
        present.

        value is the list of elements to append.
        N)rr   )ru   rˆ   Úelry   ry   rz   r‰   ë   s    
z_UniqueList.extendc             C   s   | j S )z'Return the list as a raw list.
        )r‡   )ru   ry   ry   rz   Úas_listô   s    z_UniqueList.as_list)N)	rƒ   rp   r„   r…   r{   rr   rŠ   r‰   rŒ   ry   ry   ry   rz   r†   Ï   s   

	r†   c               @   s@   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dS )Ú_Macroz/A macro that can be manipulated as a list.
    c             C   s   || _ |  |¡ dS )zzInitialise the instance.

        name is the name of the macro.
        value is the initial value of the macro.
        N)Ú_nameÚset)ru   r~   rˆ   ry   ry   rz   r{   ý   s    z_Macro.__init__c             C   s>   g | _ t|tƒr| ¡ }t|ƒtkr0|  |¡ n
|  |¡ dS )zšExplicitly set the value of the macro.

        value is the new value.  It may be a string, a list of strings or a
        _UniqueList instance.
        N)Ú_macroÚ
isinstancer†   rŒ   ÚtypeÚlistr‰   rr   )ru   rˆ   ry   ry   rz   r     s    
z
_Macro.setc             C   s   |r| j  |¡ dS )zLAppend a value to the macro.

        value is the value to append.
        N)r   rr   )ru   rˆ   ry   ry   rz   rr     s    z_Macro.appendc             C   s   x|D ]}|   |¡ qW dS )zgAppend each element of a value to the macro.

        value is the list of elements to append.
        N)rr   )ru   rˆ   r‹   ry   ry   rz   r‰     s    
z_Macro.extendc             C   s"   y| j  |¡ W n   Y nX dS )zŠRemove a value from the macro.  It doesn't matter if the value 
        wasn't present. 
 
        value is the value to remove. 
        N)r   Úremove)ru   rˆ   ry   ry   rz   r”   &  s    z_Macro.removec             C   s   | j S )z$Return the macro as a list.
        )r   )ru   ry   ry   rz   rŒ   1  s    z_Macro.as_listN)
rƒ   rp   r„   r…   r{   r   rr   r‰   r”   rŒ   ry   ry   ry   rz   r   ú   s   	r   c               @   sÄ   e Zd ZdZd0dd„Zdd„ Zd1d	d
„Zdd„ Zdd„ Zdd„ Z	d2dd„Z
dd„ Zdd„ Zd3dd„Zd4dd„Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&d'„ Zd(d)„ Zd*d+„ Zd,d-„ Zd5d.d/„ZdS )6ÚMakefilez9The base class for the different types of Makefiles.
    r   é   Nc          	   C   s8  |r>t |dƒstdƒ |jdkr4t|ƒtkr4ddg}|j| _n|| _|| _|| _|| _	|| _
|| _|| _|| _|
| _|| _d| _|	r”tj |	¡| _n
t ¡ | _| j| _|dkr¸|j| _n|| _|dkrÐ|j| _n|| _|dkrè|j| _n|| _d| _| ¡ }x’t| ¡ ƒD ]‚}yt ||ƒ}W n t!k
r:   || }Y nX |d	ksX|dd
… dkr`| "¡ }|dd… dkrz| "¡ }t#||ƒ| j$|< q
W |  %dd¡| _&g | _'g | _(g | _)g | _*g | _+g | _,g | _-g | _.t/j0dkrìd}d}d}d}nd}d}d}d}|  %d|¡| _1|  %d|¡| _2|  %d|¡| _3|  %d|¡| _4dS )a  Initialise an instance of the target.  All the macros are left
        unchanged allowing scripts to manipulate them at will.

        configuration is the current configuration.
        console is set if the target is a console (rather than windows) target.
        qt is set if the target uses Qt.  For Qt v4 a list of Qt libraries may
        be specified and a simple non-zero value implies QtCore and QtGui.
        opengl is set if the target uses OpenGL.
        python is set if the target #includes Python.h.
        debug is set to generated a debugging version of the target.
        threaded is set if the target requires thread support.  It is
        automatically set if the target uses Qt and Qt has thread support
        enabled.
        warnings is set if compiler warning messages are required.
        debug is set if debugging symbols should be generated.
        dir is the directory for build files and Makefiles.
        makefile is the name of the Makefile.
        installs is a list of extra install targets.  Each element is a two
        part list, the first of which is the source and the second is the
        destination.  If the source is another list then it is a set of source
        files and the destination is a directory.
        universal is the name of the SDK if the target is a MacOS/X universal
        binary.  If it is None then the value is taken from the configuration.
        arch is the space separated MacOS/X architectures to build.  If it is
        None then it is taken from the configuration.
        deployment_target MacOS/X deployment target.  If it is None then it is
        taken from the configuration.
        Ú
qt_versionz8The target uses Qt but pyqtconfig has not been imported.i   ÚQtCoreÚQtGuir   Nr   )r=   r'   é   )rA   rR   é   rU   rc   r   Úwin32ÚcopyÚdelÚmkdirzif not existzcp -fzrm -fzmkdir -pztest -dr(   r>   rd   r&   )5rq   Úerrorr—   r’   r“   Zqt_threadedÚ	_threadedÚconfigÚconsoleÚ_qtÚ_openglÚ_pythonÚ	_warningsÚ_debugÚ	_makefileÚ	_installsÚ_infixÚosÚpathÚabspathÚdirÚgetcwdÚ_src_dirr   Ú
_universalr   Ú_archr   Ú_deployment_targetÚ
_finalisedr€   ÚkeysÚgetattrr}   Úsplitr   Ú__dict__Úoptional_stringÚ	generatorÚextra_cflagsÚextra_cxxflagsÚextra_definesÚextra_include_dirsÚextra_lflagsÚextra_lib_dirsÚ
extra_libsÚextra_source_dirsrn   r   r   ÚrmrŸ   Úchkdir)ru   Úconfigurationr£   ÚqtÚopenglÚpythonÚthreadedÚwarningsÚdebugr¯   ÚmakefileÚinstallsr   r   r   r   ÚmÚvalZdef_copyZdef_rmZ	def_mkdirZdef_chk_dir_existsry   ry   rz   r{   :  s‚     






zMakefile.__init__c       5      C   sJ  | j r<| jj ¡ }d|k}d|k}d|k}d|k}| jj}nd}d}d}d}d}tƒ }| | j¡ | |  d¡¡ tƒ }| | j	¡ | |  d¡¡ tƒ }	|	 | j
¡ |	 |  d	¡¡ td
gƒ}
|
 | j¡ |
 |  d¡¡ tƒ }| | j¡ | |  d¡¡ tƒ }| | j¡ | |  d¡¡ tjdkr¬g }g }x0| j ¡ D ]"}d| }| |¡ | |¡ q@W | jrŽ| d| j ¡ | d| j ¡ | |¡ | |¡ | |¡ g }x8| jD ].}| |  |¡¡ | j r¸| |  |¡¡ q¸W | |  d¡¡ tƒ }xB| jD ]8}tj |¡}d|kr&q|dkr4q| |¡ qW | jrn|
 | jj¡ |
 | jj¡ tjdkr´| | jj¡ d| jjd? | jjd? d@ f }| |  |¡¡ nºtjdkrn| | jj¡ d| jjd? | jjd? d@ f }| jdkr.|d }tj  | jj|  |¡¡}t !|tj"¡r.|}| j#r^|d }| jdkr^| d ¡ | d ¡ | |  |¡¡ | jd!kr"|rŠd"}d#}nd$}d%}| |  |¡¡ | |  |¡¡ |rÂd&}d'}nd(}d)}| |  |¡¡ | |  |¡¡ |rúd*}d+}nd,}d-}| |  |¡¡ | |  |¡¡ | j#rP|r:d.}d/}nd0}d1}d2} d3}!d4}"n$|r`d5}d6}nd7}d8}d9} d:}!d;}"| jd!krÐ| j$r¨| |  |¡¡ | |  |¡¡ | j%rÐ| |  d<¡¡ | |  d=¡¡ | |  | ¡¡ | |  |!¡¡ | |  |"¡¡ | j&rd>}#d?}$nd@}#dA}$| |  |#¡¡ | |  |$¡¡ | j$rr| |  dB¡¡ | |  dC¡¡ | |  dD¡¡ | j rÐy| jj'}%W n t(k
r¤   | jj)}%Y nX tj  |%dE¡}&| jdFkrÐ|rÐ|	 dG¡ | j#sâ|	 dH¡ |dIkrlxŽ| j D ]n}'|'dJkr|	 dK¡ n|'dLkr,|	 dM¡ n|'dNkrB|	 dO¡ nð|'dPkrX|	 dQ¡ nÚ|'dRkrn|	 dS¡ nÄ|'dTkr„|	 dU¡ n®|'dVkrš|	 dW¡ n˜|'dXkr°|	 dY¡ n‚|'dZkrÆ|	 d[¡ nl|'d\krÜ|	 d]¡ nV|'d^krò|	 d_¡ n@|'d`kr|	 da¡ n*|'dbkr|	 dc¡ n|'ddkr2|	 de¡ |dfkrö|'d\krP|	 dO¡ |'dgkrö|	 dh¡ qöW n| j$r~|	 di¡ |  dj¡}(| |(¡ | |(¡ |dIk	r¦tj  |&dk¡})|  *|)dl¡| _+dmdndodpdqdrœ}*dsdtdudvdwdxdwdydwdzdvd{dwd|dvd}d~œ}+dddwd€dvdwdvdwdydwddvddwd|dvdvdvd‚œ},|dfkr2|+}-n|,}-dZ| j krZdN| j krZ| j  dN¡ |dƒkr d„| j kr dN| j krˆ| j  dN¡ dR| j kr | j  dR¡ xp| j D ]ö}'|  ,|'¡}.| |  |.|  -|'¡¡¡ tjdk	r†tƒ }/|'t.|* /¡ ƒk	r|/ |  |*|' ¡¡ |'t.|- /¡ ƒk	rvxZ|-|' D ]N}0|0| j k	r$| |  |  ,|0¡¡¡ |0t.|* /¡ ƒk	r$|/ |  |*|0 ¡¡ 	q$W | |/ 0¡ ¡ n| |  |.|  -|'¡¡¡ qªW nn| jj1}1| jd!k	rê|	rê|1t2|ƒ 3d
d…¡ }1| jj4d†k	rê|1d‡ }1| |  |1| jj5¡¡ | |  | jj1¡¡ tj  |&dˆ¡}2t !|2tj"¡
sDtj  |&| jj¡}2|
 |2¡ |  d‰¡}3|3rÐ|dIkrÆxZ| j D ]N}'|'dŠk
rž|
 tj  |3d d‹¡¡ 
qr|  -|'¡rH|(d }4|'d„k
rÊ|dŒk 
rÊd}'|
 tj  |4|'dŽ d¡¡ |dfkrÀ|'dNkr&|
 tj  |4dd¡¡ |
 tj  |4d‘d¡¡ n |'d^krÀ|
 tj  |4d’d¡¡ nx|3d }4|
 tj  |4|'¡¡ |dfk
rr|'dNkr¢|
 tj  |4d“¡¡ |
 tj  |4d”¡¡ n|'d^k
rr|
 tj  |4d•¡¡ 
qrW |
 |3¡ | j6r|
 |  d–¡¡ | |  d—¡¡ | |  d˜¡¡ | |  dp¡¡ | j s(| j6rv|dIk sF| j6sFdN| j krv|
 |  d™¡¡ | |  dš¡¡ | |  d›¡¡ | j$r | |  dœ¡¡ | |  d¡¡ n| |  dž¡¡ | j%rÈ| |  dŸ¡¡ | |  d ¡¡ | |  7| 0¡ ¡¡ | j8 9|¡ | j: 9|¡ | j; 9|	¡ | j< 9|
¡ | j= 9|¡ | j> 9|¡ | j? 9|¡ d| _@d¡S )¢zbFinalise the macros by doing any consolidation that isn't specific
        to a Makefile.
        ÚsharedÚ
exceptionsZrttiZstlr–   r   r   r*   r=   Ú.rA   rD   rR   Údarwinz-arch z-isysroot %sz-Wl,-syslibroot,%srU   z/qpy/)r   rÓ   z..Úcygwinzpython%u.%ué   é   éÿ   rœ   z
python%u%uÚBMAKEZ_bcppÚ_dÚMINGWz/D_DEBUG)ÚMSVCzMSVC.NETÚMSBUILDrÙ   r   r/   r   r.   r   r6   r   r5   r"   r9   r!   r8   r   r3   r   r1   r   r-   rG   r   r2   r   r0   r   r4   rK   r   r,   r%   r<   r$   r;   r#   r:   rN   Úmkspecsr   ZQT_DLLZQT_NO_DEBUGi   r˜   ZQT_CORE_LIBÚQtDeclarativeZQT_DECLARATIVE_LIBr™   Z
QT_GUI_LIBÚQtMultimediaZQT_MULTIMEDIA_LIBÚ	QtNetworkZQT_NETWORK_LIBÚQtOpenGLZQT_OPENGL_LIBÚQtScriptZQT_SCRIPT_LIBÚQtScriptToolsZQT_SCRIPTTOOLS_LIBÚQtSqlZ
QT_SQL_LIBÚQtTestZQT_TEST_LIBÚQtWebKitZQT_WEBKIT_LIBÚQtXmlZ
QT_XML_LIBÚQtXmlPatternsZQT_XMLPATTERNS_LIBÚphononZQT_PHONON_LIBi   )rå   ræ   ZQT_WIDGETS_LIBZQT_THREAD_SUPPORTZ	LIBDIR_QTzqconfig.priZQT_LIBINFIXrW   rX   rY   rZ   r^   )r˜   r™   rá   râ   rç   )ré   rá   rå   rã   Ú	QtWidgetsr™   r˜   )ÚQtPrintSupportrë   r˜   )rá   rå   rë   r™   r˜   )r™   r˜   )r˜   )rë   r™   r˜   )rã   r™   r˜   )rè   rë   r™   r˜   )rá   ÚQtWebKitWidgetsrë   r™   r˜   )rá   r˜   )Z	Qt5AxBaserë   r™   r˜   )rß   r™   ÚQtHelprà   rá   râ   rã   rä   rå   ÚQtSvgræ   rç   rè   ré   Ú
QtDesignerÚQAxContainer)rá   r™   r˜   )rå   r™   r˜   )rè   r™   r˜   )ÚQtAssistantrß   r™   rî   rà   rá   râ   rã   rä   rå   rï   ræ   rç   rè   ré   rê   rð   rñ   i  rò   r   znon-commercialZncÚdefaultZ	INCDIR_QTrñ   ZActiveQti ÚQtAssistantClientz
.frameworkZHeaderszQtWidgets.frameworkzQtPrintSupport.frameworkzQtWebKitWidgets.frameworkrë   rì   rí   rB   rI   rS   rC   rT   r`   r]   r\   r[   rV   r_   N)Ar¤   r¢   Úqt_winconfigr¸   r—   r†   r‰   r¼   Úoptional_listr½   r¾   r¿   rÀ   rÁ   rn   r   r³   rr   r²   rŠ   rÂ   Úplatform_libÚ_dependent_libsr¬   r­   Údirnamer¦   r	   r   r
   r   r»   ÚjoinÚaccessÚF_OKr¨   r¡   r£   r§   Zqt_data_dirr}   Zqt_dirÚ_extract_valuer«   Ú_qt_module_to_libÚ_is_frameworkr“   r¶   rŒ   Úqt_libÚversion_to_stringÚreplaceZ
qt_editionr   r¥   Ú_platform_rpathsr   r   r*   r=   rA   rD   rR   rU   rµ   )5ru   ZwcfgZ
win_sharedZwin_exceptionsZwin_rttiZwin_stlr—   ZcflagsZcxxflagsZdefinesZincdirÚlflagsZlibdirZ
mac_cflagsZ
mac_lflagsÚaZaflagÚlibsÚlÚrpathsZl_dirZpy_libZbpy_libZbpy_lib_pathZcflags_exceptionsZcxxflags_exceptionsZcflags_rttiZcxxflags_rttiZ
cflags_stlZcxxflags_stlZ	cflags_mtZcxxflags_mtZcflags_debugZcxxflags_debugZlflags_debugZcflags_warnZcxxflags_warnZ
specd_baserÞ   rw   Z	libdir_qtZqconfigZwdepmapZ
qt5_depmapZ
qt4_depmapZ	qt_depmapÚlibZdepsZqdepr   ZspecdZqtincdirZidirry   ry   rz   ÚfinaliseÆ  s   








  






























 














zMakefile.finalisec             C   s,   |dkrd}| j  d¡ | j  d| ¡ dS )z9Add the link flags for creating a manifest file.
        Nz	$(TARGET)z	/MANIFESTz/MANIFESTFILE:%s.manifest)rD   rr   )ru   Útargetry   ry   rz   Ú_add_manifestª  s    zMakefile._add_manifestc             C   s   | j jo| j jdkp|dkS )z;Return true if the given Qt module is a framework.
        i  rò   )r¢   r   r—   )ru   rw   ry   ry   rz   rÿ   ³  s    zMakefile._is_frameworkc             C   s*  | j j}|dkr.|dkr(tjdkr(|}q2d}n|}|| j7 }| jr„tjdkrV|d }n.tjdkrt|  |¡s„|d }n|dk r„|d }d	}tjdkrôd
| j j ¡ krô|dksº|dkrò|dkrò|dkrÜ|dkròd|dd…  }n|dkrêd}n|d }ntj 	d¡r|dkrd}|r&d|dd…  }|S )zoReturn the name of the Qt library corresponding to a module.

        mname is the name of the module.
        rò   i rÔ   rô   rœ   Údr¨   i  FrÑ   )r˜   rß   rð   r™   rî   rà   rá   râ   rã   rä   rå   rï   ræ   rç   rè   ré   rê   rñ   rì   rí   rë   rñ   i   ZQt5r–   NTÚ4Úlinuxé   )
r¢   r—   rn   r   r«   r¨   rÿ   rõ   r¸   Ú
startswith)ru   Úmnamer—   r	  Z
qt5_renamery   ry   rz   rþ   ¸  s<    






zMakefile._qt_module_to_libc             C   s   | j |  ¡ S )z]Return an optional Makefile macro as a list.

        name is the name of the macro.
        )r¹   rŒ   )ru   r~   ry   ry   rz   rö   ë  s    zMakefile.optional_listr   c             C   s   d  |  |¡¡}|s|}|S )z„Return an optional Makefile macro as a string.

        name is the name of the macro.
        default is the default value
        ú )rú   rö   )ru   r~   ró   Úsry   ry   rz   rº   ò  s    zMakefile.optional_stringc             C   s   |   |¡}|std| ƒ‚|S )z^Return a required Makefile macro as a string.

        name is the name of the macro.
        z "%s" must have a non-empty value)rº   Ú
ValueError)ru   r~   r  ry   ry   rz   Úrequired_stringÿ  s    
zMakefile.required_stringc             C   sL   g }|   d¡}|dkr |   d¡}|dkrHx|D ]}| t|| ƒ¡ q.W |S )zjReturn a list of platform specific rpath flags.

        rpaths is the cannonical list of rpaths.
        rf   r   rL   )rº   rr   Ú_quote)ru   r  ÚflagsÚprefixÚrry   ry   rz   r    s    


zMakefile._platform_rpathsc             C   s8   | j dkr|d }n tjdkr,|r,d| }nd| }|S )z¼Return a library name in platform specific form.

        clib is the library name in cannonical form.
        framework is set of the library is implemented as a MacOS framework.
        )rÜ   zMSVC.NETrÝ   rÙ   z.librÔ   z-framework z-l)r»   rn   r   )ru   ÚclibÚ	frameworkZplibry   ry   rz   r÷     s    


zMakefile.platform_libc             C   sæ   | j dkr"tj | jj|d ¡}nFtjdkrN|rNtj | jj|d |d ¡}ntj | jjd| d ¡}|  |d¡ 	¡ }| jj
dkrâg }|dkr¦| d	¡ | d
¡ n|dkr¸| d¡ x(|D ] }| |  |  |¡|¡ 	¡ ¡ q¾W |S )zùReturn a list of additional libraries (in platform specific form)
        that must be linked with a library.

        clib is the library name in cannonical form.
        framework is set of the library is implemented as a MacOS framework.
        )rÜ   zMSVC.NETrÝ   rÙ   z.prlrÔ   z
.frameworkr	  ZQMAKE_PRL_LIBSi   )r™   ZQt5Guirë   rì   )rç   Z	Qt5WebKitrí   )r»   r¬   r­   rú   r¢   Z
qt_lib_dirrn   r   rý   r¸   r—   rr   r‰   r÷   rþ   )ru   r  r  Zprl_namer  Z	xtra_libsZxtrary   ry   rz   rø   ,  s$    



zMakefile._dependent_libsc             C   s¼   d}t  |t j¡r¸yt|dƒ}W n  tk
r@   td| ƒ Y nX | ¡ }xd|r®| ¡ }|r¤|d dkr¤| d¡}|dkr¤|d|…  ¡ |kr¤||d d…  ¡ }P | ¡ }qLW | 	¡  |S )	z”Return the stripped value from a name=value line in a file.

        fname is the name of the file.
        vname is the name of the value.
        r   r  zUnable to open "%s"r   ú#ú=Nr–   )
r¬   rû   rü   ÚopenÚIOErrorr    Úreadliner   ÚfindÚclose)ru   ÚfnameZvnamerˆ   ÚfÚlineÚeqry   ry   rz   rý   L  s"    
zMakefile._extract_valuec          	   C   s6  t |ƒtkrd}|}nðtj |¡r6tj |¡| _|}ntj | j|¡}i }yt	|dƒ}W n  t
k
rx   td| ƒ Y nX d}| ¡ }xv|rü| ¡ }|rê|d dkrê| d¡}|dkrÆtd||f ƒ ||d d	…  ¡ ||d	|…  ¡ < |d }| ¡ }qˆW | ¡  xBd
D ]:}y||  W n& tk
rB   td||f ƒ Y nX qW x:dD ]2}y||  W n tk
r~   d||< Y nX qPW | jdkr˜d}	nd}	g }
x4|d  ¡ D ]$}tj |¡\}}|
 ||	 ¡ q®W xL|d  ¡ D ]<}| jsütd| ƒ tj |¡\}}|
 d| |	 ¡ qäW d |
¡|d< |S )zÆ
        Parse a build file and return the corresponding dictionary.

        filename is the name of the build file.  If it is a dictionary instead
        then its contents are validated.
        Z
dictionaryr  zUnable to open "%s"r–   r   r  r  z?"%s" line %d: Line must be in the form 'name = value value...'.N)r  Úsourcesz"%s" is missing from "%s".)ÚheadersÚmoc_headersr   )rÜ   zMSVC.NETrÝ   rÙ   z.objz.or(  r*  z/"%s" defines "moc_headers" for a non-Qt module.Úmoc_r  Úobjects)r’   Údictr¬   r­   Úisabsrù   r±   rú   r¯   r  r   r    r!  r   r"  r#  r|   r»   r¸   Úsplitextrr   r¤   )ru   ÚfilenameZbfnameZbdictr%  Zline_nrr&  r'  ÚiÚextZolistÚrootÚdiscardry   ry   rz   Úparse_build_filei  s`    
$

zMakefile.parse_build_filec             C   sx   |  d| j ¡ x(|d  ¡ D ]}|  d| j|f ¡ qW x8|d  ¡ D ](}tj |¡\}}|  d| j|f ¡ qHW dS )zƒGenerate the clean target.

        mfile is the file object.
        build is the dictionary created from the build file.
        z	-%s $(TARGET)
r,  z	-%s %s
r*  z	-%s moc_%s.cpp
N)ÚwriterÄ   r¸   r¬   r­   r/  )ru   ÚmfileÚbuildr%  r3  r4  ry   ry   rz   Úclean_build_file_objectsº  s    z!Makefile.clean_build_file_objectsc             C   s   | j s|  ¡  dS )z.The Makefile is now ready to be used.
        N)rµ   r
  )ru   ry   ry   rz   ÚreadyÉ  s    zMakefile.readyc             C   sÜ   |   ¡  yt | j¡ W n   Y nX tj | j| j¡}yt|dƒ}W n  tk
rf   t	d| ƒ Y nX |  
|¡ |  |¡ |  |¡ | jrÆt| jƒtkr¤| jg| _x | jD ]\}}|  |||¡ q¬W |  |¡ | ¡  dS )zGenerate the Makefile.
        ÚwzUnable to create "%s"N)r:  r¬   Úmakedirsr¯   r­   rú   r©   r  r   r    Úgenerate_macros_and_rulesÚgenerate_target_defaultÚgenerate_target_installrª   r’   r“   Úinstall_fileÚgenerate_target_cleanr#  )ru   Zmfnamer7  ÚsrcÚdstry   ry   rz   ÚgenerateÏ  s(    




zMakefile.generatec       
      C   s’  | j r| d| j  ¡ tjdkr$dnd}| d||  d¡f ¡ | d||  d¡f ¡ | d	||  d
¡f ¡ g }| js„| d¡ x |  d¡D ]}| d| ¡ qW x$|  d¡D ]}| dt|ƒ ¡ q²W g }| j	dkràd}nd}xZ|  d¡D ]L}tjdkr*| j
jr*dt|ƒ }| |¡ | |¡ | |t|ƒ ¡ qðW | |  d¡¡ | dd |¡ ¡ | d|  d¡ ¡ | d|  d¡ ¡ | d|  d¡ ¡ | dd |¡ ¡ | jrÔ| d t|  d!¡ƒ ¡ t| jƒ}	| j| jkrø|	 | j¡ |	 ¡ r| d"d |	 ¡ ¡ ¡ | j	d#kr2| d$¡ n"| j	d%krJ| d&¡ n
| d'¡ | j	dkrl| d(¡ n"| j	d)kr„| d*¡ n
| d+¡ d,S )-zjThe default implementation of the macros and rules generation.

        mfile is the file object.
        z%export MACOSX_DEPLOYMENT_TARGET = %s
rœ   r  z?=z	CC %s %s
r   z
CXX %s %s
r)   zLINK %s %s
ra   z-DNDEBUGr=   z-DrA   z-I)rÜ   zMSVC.NETrÝ   z	/LIBPATH:z-LrR   rÔ   z-FrU   zCPPFLAGS = %s
r  zCFLAGS = %s
r   zCXXFLAGS = %s
r*   zLFLAGS = %s
rD   z
LIBS = %s
z	MOC = %s
ZMOCzVPATH = %s

rÛ   z .SUFFIXES: .cpp .cxx .cc .C .c

r   z#.SUFFIXES: .c .o .cpp .cc .cxx .C

z .SUFFIXES: .c .cpp .cc .cxx .C

aG  
{.}.cpp{}.obj::
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -Fo @<<
	$<
<<

{.}.cc{}.obj::
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -Fo @<<
	$<
<<

{.}.cxx{}.obj::
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -Fo @<<
	$<
<<

{.}.C{}.obj::
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -Fo @<<
	$<
<<

{.}.c{}.obj::
	$(CC) -c $(CFLAGS) $(CPPFLAGS) -Fo @<<
	$<
<<
rÙ   a  
.cpp.obj:
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o$@ $<

.cc.obj:
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o$@ $<

.cxx.obj:
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o$@ $<

.C.obj:
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o$@ $<

.c.obj:
	$(CC) -c $(CFLAGS) $(CPPFLAGS) -o$@ $<
a  
.cpp.o:
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o $@ $<

.cc.o:
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o $@ $<

.cxx.o:
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o $@ $<

.C.o:
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o $@ $<

.c.o:
	$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
N)r´   r6  rn   r   r  r¨   rr   rö   r  r»   r¢   r   r‰   rú   rº   r¤   r†   rÃ   r±   r¯   rŒ   )
ru   r7  Z	maybe_envZcppflagsr%  r  Úlibdir_prefixÚldZfflagZvpathry   ry   rz   r=  ð  sb    






z"Makefile.generate_macros_and_rulesc             C   s   |  d¡ dS )z]The default implementation of the default target.

        mfile is the file object.
        z
all:
N)r6  )ru   r7  ry   ry   rz   r>  s  s    z Makefile.generate_target_defaultc             C   s   |  d¡ dS )z]The default implementation of the install target.

        mfile is the file object.
        z

install:
N)r6  )ru   r7  ry   ry   rz   r?  z  s    z Makefile.generate_target_installc             C   s   |  d¡ dS )z[The default implementation of the clean target.

        mfile is the file object.
        z
clean:
N)r6  )ru   r7  ry   ry   rz   rA    s    zMakefile.generate_target_cleanc             C   sÚ   | j dkrd| }| d| jt|ƒf ¡ | j dkr>| d¡ | d| jt|ƒf ¡ t|ƒtkrh|g}|r~|  d¡}|s~d}xV|D ]N}ttj	 
|tj	 |¡¡ƒ}| d| jt|ƒ|f ¡ |r„| d	||f ¡ q„W d
S )a@  Install one or more files in a directory.

        mfile is the file object.
        src is the name of a single file to install, or the list of a number of
        files to install.
        dst is the name of the destination directory.
        strip is set if the files should be stripped after been installed.
        r   z
$(DESTDIR)z	@%s %s z|| z%s %s
rg   r   z
	%s %s %s
z	%s %s
N)r»   r6  rÅ   r  rŸ   r’   r“   rº   r¬   r­   rú   Úbasenamer   )ru   r7  rB  rC  r   Z	strip_cmdÚsfr  ry   ry   rz   r@  ˆ  s"    





zMakefile.install_file)r   r   r   r   r   r–   r   Nr•   NNNN)N)r   )r   )r   )r   )rƒ   rp   r„   r…   r{   r
  r  rÿ   rþ   rö   rº   r  r  r÷   rø   rý   r5  r9  r:  rD  r=  r>  r?  rA  r@  ry   ry   ry   rz   r•   7  s<      
 
   g
	3


 Q! r•   c               @   sD   e Zd ZdZddd„Zdd„ Zdd	„ Zd
d„ Zdd„ Zddd„Z	dS )ÚParentMakefilez1The class that represents a parent Makefile.
    Nr•   c             C   s   t j| ||||d || _dS )ziInitialise an instance of a parent Makefile.

        subdirs is the sequence of subdirectories.
        )r¯   rÍ   rÎ   N)r•   r{   Ú_subdirs)ru   rÆ   Zsubdirsr¯   rÍ   rÎ   ry   ry   rz   r{   ²  s    zParentMakefile.__init__c             C   s   dS )zJGenerate the macros and rules.

        mfile is the file object.
        Nry   )ru   r7  ry   ry   rz   r=  ¼  s    z(ParentMakefile.generate_macros_and_rulesc             C   s   |   |¡ dS )zHGenerate the default target.

        mfile is the file object.
        N)Ú_subdir_target)ru   r7  ry   ry   rz   r>  Ä  s    z&ParentMakefile.generate_target_defaultc             C   s   |   |d¡ dS )zHGenerate the install target.

        mfile is the file object.
        ZinstallN)rK  )ru   r7  ry   ry   rz   r?  Ë  s    z&ParentMakefile.generate_target_installc             C   s   |   |d¡ dS )zFGenerate the clean target.

        mfile is the file object.
        ZcleanN)rK  )ru   r7  ry   ry   rz   rA  Ò  s    z$ParentMakefile.generate_target_cleanÚallc             C   sž   |dkrd}nd| }|  d| d ¡ xp| jD ]f}| jdkrR|  d||f ¡ q0| jdkrp|  d	||f ¡ q0|  d
| ¡ |  d| ¡ |  d¡ q0W dS )z„Create a target for a list of sub-directories.

        mfile is the file object.
        target is the name of the target.
        rL  r   r  Ú
z:
rÛ   z	@$(MAKE) -C %s%s
r   z	@(cd %s; $(MAKE)%s)
z	cd %s
z	$(MAKE)%s
z	@cd ..
N)r6  rJ  r»   )ru   r7  r  Ztnamer  ry   ry   rz   rK  Ù  s    

zParentMakefile._subdir_target)Nr•   N)rL  )
rƒ   rp   r„   r…   r{   r=  r>  r?  rA  rK  ry   ry   ry   rz   rI  ¯  s    
	rI  c               @   s*   e Zd ZdZd
dd„Zdd„ Zdd	„ ZdS )ÚPythonModuleMakefilez8The class that represents a Python module Makefile.
    Nr•   c             C   sH   t j| ||||d |sd}|r2tj ||¡| _n|| _|| _|| _dS )ac  Initialise an instance of a parent Makefile.

        dstdir is the name of the directory where the module's Python code will
        be installed.
        srcdir is the name of the directory (relative to the directory in which
        the Makefile will be created) containing the module's Python code.  It
        defaults to the same directory.
        )r¯   rÍ   rÎ   rÓ   N)r•   r{   r¬   r­   rú   Ú_moddirÚ_srcdirÚ_dstdir)ru   rÆ   ZdstdirZsrcdirr¯   rÍ   rÎ   ry   ry   rz   r{   ô  s    
zPythonModuleMakefile.__init__c             C   s   dS )zJGenerate the macros and rules.

        mfile is the file object.
        Nry   )ru   r7  ry   ry   rz   r=    s    z.PythonModuleMakefile.generate_macros_and_rulesc       	      C   s¾   t  | |¡ x¬t | j¡D ]œ\}}}xdD ]}||kr*| |¡ q*W |t| jƒd… }g }xF|D ]>}|dkrnq`tj tj 	||¡¡r`| 
tj 	| j| |¡¡ q`W |  ||| j| ¡ qW dS )zHGenerate the install target.

        mfile is the file object.
        )z.svnZCVSNr•   )r•   r?  r¬   ÚwalkrO  r”   Úlenr­   Úisfilerú   rr   rP  r@  rQ  )	ru   r7  r3  ÚdirsÚfilesÚskipÚtailZflistr%  ry   ry   rz   r?    s    

z,PythonModuleMakefile.generate_target_install)NNr•   N)rƒ   rp   r„   r…   r{   r=  r?  ry   ry   ry   rz   rN  ñ  s
    
rN  c               @   sJ   e Zd ZdZddd„Zdd	„ Zd
d„ Zdd„ Zdd„ Zdd„ Z	dd„ Z
dS )ÚModuleMakefilezAThe class that represents a Python extension module Makefile
    Nr   r–   r•   c             C   sÜ   t  | ||||d||	|
||||||¡ |  |¡| _|| _|| _d|  d¡k| _|
sV|rdd| _d| _	n|| _| | _	| jd | _
| jjdkr˜d| j
 | _nd| j
 | _tjd	kr¾|r¾d
| j
 | _
tjd	krØ|
rØ| j
d | _
dS )a
  Initialise an instance of a module Makefile.

        build_file is the file containing the target specific information.  If
        it is a dictionary instead then its contents are validated.
        install_dir is the directory the target will be installed in.
        static is set if the module should be built as a static library.
        strip is set if the module should be stripped of unneeded symbols when
        installed.  The default is 1.
        export_all is set if all the module's symbols should be exported rather
        than just the module's initialisation function.  Exporting all symbols
        increases the size of the module and slows down module load times but
        may avoid problems with modules that use exceptions.  The default is 0.
        r–   Zembed_manifest_dllr'   r   r  i   z	PyInit_%szinit%srœ   r	  rÚ   N)r•   r{   r5  Ú_buildÚ_install_dirÚstaticrö   Ú	_manifestÚ_stripÚ_limit_exportsÚ_targetr¢   r   Ú_entry_pointrn   r   )ru   rÆ   Ú
build_fileÚinstall_dirr\  r£   rÇ   rÈ   rÊ   rË   rÌ   r¯   rÍ   rÎ   r   Ú
export_allr   r   r   ry   ry   rz   r{   0  s$    &zModuleMakefile.__init__c             C   s¬  | j rd}nd}| jr$| j d¡ n”| j |  d¡¡ | j |  d¡¡ |  d¡}|rd| j |¡ n| j rpd}nd}| j	r‚|  
¡  tjd	kr”d
g}n
|  d¡}|s¬|  d¡}| j |¡ | j |  |¡¡ tjd	krà| j d¡ t | ¡ | jsœ|  d¡r–|  d¡dkrJd| jj g}| jr†| d¡ | d¡ | d| j ¡ n<dd| jj g}| jr†| d¡ | d¡ | d| j ¡ | j |¡ n| jr€tjdd… dkrÈ| j d| j g¡ n¸tjdd… dkr|  d¡dkr| j dd | j g¡ n| j d!d"d#| j g¡ nbtjdd… d$krH| j d%| j g¡ n8tjdd… d&kr€|  d¡dkr€| j d'| j g¡ |  d(¡}|rœ| j |¡ | j d)¡ dS )*z<Finalise the macros common to all module Makefiles.
        rE   rO   ZSIP_STATIC_MODULEr    r7   rH   rF   rP   rÔ   z-bundlerJ   rM   z-undefined dynamic_lookupr   ra   zg++z-Wl,-bI:%s/python.expz-Wl,-bnoexpallz-Wl,-bnoentryz-Wl,-bE:%s.expz
-qmkshrobjz-bI:%s/python.expz
-bnoexpallz	-bnoentryz
-bE:%s.expNé   r  z-Wl,--version-script=%s.expÚsunosz-Wl,-z,noversionz-Wl,-M,%s.expz-znoversionz-Mz%s.expzhp-uxz	-Wl,+e,%sZirixz-Wl,-exported_symbol,%srb   z-Wl,--no-undefined)r£   r\  r=   rr   r   r‰   rö   r*   rD   r]  r  rn   r   r•   r
  rº   r  r¢   r
   r_  r`  ra  ra   r   r”   )ru   Úlflags_consoleZ
lflags_dllZlflags_pluginZ
aix_lflagsZ
link_shlibry   ry   rz   r
  b  sn    









$
zModuleMakefile.finalisec             C   s   t dƒ‚dS )z»Return the name of a SIP v3.x module when it is used as a library.
        This will raise an exception when used with SIP v4.x modules.

        mname is the name of the module.
        z.module_as_lib() can only be used with SIP v3.xN)r  )ru   r  ry   ry   rz   Úmodule_as_libÆ  s    zModuleMakefile.module_as_libc             C   sR  | j rtjdkrd}qfd}nJtjdkr,d}n:tjdkr<d}n*tjdkrLd}n|  d	¡}|sf|  d
d¡}| d| jd |  ¡ | d| jd  ¡ | d| jd | jd f ¡ | d¡ | j rB| jdkrâ| d|  d¡ ¡ n`| jdkr
| d|  d¡ ¡ d| _	n8| d|  d¡ ¡ |  d¡| _	| j	rB| d| j	 ¡ t
 | |¡ dS )zUGenerate the macros and rules generation.

        mfile is the file object.
        rœ   r	  r  ZpydrÔ   ZsorÕ   Zdllr?   r@   zTARGET = %s
rÓ   zOFILES = %s
r,  zHFILES = %s %s
r)  r*  rM  )rÜ   zMSVC.NETrÝ   rÙ   z	LIB = %s
rQ   rÛ   zAR = %s
Nr   re   zRANLIB = %s
)r\  rn   r   rº   r6  r`  rZ  r»   r  Ú_ranlibr•   r=  )ru   r7  r2  ry   ry   rz   r=  Î  s8    






z(ModuleMakefile.generate_macros_and_rulesc       	      C   sª  |  d¡ |  d¡ xR| jd  ¡ D ]@}tj |¡\}}d| d }|  d||f ¡ |  d| ¡ q$W |  d¡ | jd	krÔ| jr¢|  d
¡ |  d¡ |  d¡ n.|  d¡ |  d¡ |  d¡ | jrÐ|  d¡ nÒ| jdkrÌ| jr6|  d| j	 ¡ |  d¡ x&| jd  ¡ D ]}|  d| ¡ qW |  d¡ n”|  d¡ |  d| j
 ¡ |  d¡ tj | j| j
d ¡}yt|dƒ}W n" tk
r    td| ƒ Y nX |  d¡ |  d| j| jf ¡ | ¡  nÚ| jr|  d| j	 ¡ |  d¡ | jr¦|  d¡ n¤| jrœtjdd … d!kr6|  d"| j| j
f ¡ nftjdd … d#krb|  d"| j| j
f ¡ n:tjdd$… d%krœ|  d&| j
 ¡ |  d'| j| j
f ¡ |  d(¡ dS ))zHGenerate the default target.

        mfile is the file object.
        z
all: $(TARGET)
z
$(OFILES): $(HFILES)
r*  r+  z.cppz
%s: %s
z	$(MOC) -o %s $<
z
$(TARGET): $(OFILES)
)rÜ   zMSVC.NETrÝ   z	$(LIB) /OUT:$(TARGET) @<<
z	  $(OFILES)
z<<
z&	$(LINK) $(LFLAGS) /OUT:$(TARGET) @<<
z	  $(OFILES) $(LIBS)
zE	mt -nologo -manifest $(TARGET).manifest -outputresource:$(TARGET);2
rÙ   z	-%s $(TARGET)
z	$(LIB) $(TARGET) @&&|
r,  z+%s \
z|
z	$(LINK) @&&|
z,	$(LFLAGS) $(OFILES) ,$(TARGET),,$(LIBS),%s
z.defr;  zUnable to create "%s"zEXPORTS
z%s=_%s
z	$(AR) $(TARGET) $(OFILES)
z	$(RANLIB) $(TARGET)
Nre  r  z-	@echo '{ global: %s; local: *; };' > %s.exp
rf  é   Úaixz	@echo '#!' >%s.expz; \
	 echo '%s' >>%s.exp
z2	$(LINK) $(LFLAGS) -o $(TARGET) $(OFILES) $(LIBS)
)r6  rZ  r¸   r¬   r­   r/  r»   r\  r]  rÄ   r`  rú   r¯   r  r   r    ra  r#  ri  r_  rn   r   )	ru   r7  Úmfr3  r4  ÚcppZofZdefnameÚdfilery   ry   rz   r>  ù  sd    














z&ModuleMakefile.generate_target_defaultc             C   s6   | j dkr| jj| _ | d¡ |  |d| j | j¡ dS )zHGenerate the install target.

        mfile is the file object.
        Nz
install: $(TARGET)
z	$(TARGET))r[  r¢   r   r6  r@  r^  )ru   r7  ry   ry   rz   r?  G  s    


z&ModuleMakefile.generate_target_installc             C   sŠ   |  d¡ |  || j¡ | jr4| js4|  d| j ¡ | jr†tjdd… dksptjdd… dksptjdd… dkr†|  d	| j| j	f ¡ dS )
zFGenerate the clean target.

        mfile is the file object.
        z
clean:
z	-%s $(TARGET).manifest
Nre  r  rf  rj  rk  z	-%s %s.exp
)
r6  r9  rZ  r]  r\  rÄ   r_  rn   r   r`  )ru   r7  ry   ry   rz   rA  R  s    
z$ModuleMakefile.generate_target_clean)Nr   r   r   r   r   r–   r   Nr•   Nr–   r   NNN)rƒ   rp   r„   r…   r{   r
  rh  r=  r>  r?  rA  ry   ry   ry   rz   rY  -  s       
.d+NrY  c               @   s"   e Zd ZdZd
dd„Zdd	„ ZdS )ÚSIPModuleMakefilez?The class that represents a SIP generated module Makefile.
    Nr   r–   r•   c             C   s8   t  | |||||||||	|
||||||||¡ || _dS )a8  Initialise an instance of a SIP generated module Makefile.

        prot_is_public is set if "protected" is to be redefined as "public".
        If the platform's C++ ABI allows it this can significantly reduce the
        size of the generated code.

        For all other arguments see ModuleMakefile.
        N)rY  r{   Ú_prot_is_public)ru   rÆ   rb  rc  r\  r£   rÇ   rÈ   rÊ   rË   rÌ   r¯   rÍ   rÎ   r   rd  r   r   Zprot_is_publicr   ry   ry   rz   r{   g  s
    zSIPModuleMakefile.__init__c             C   s<   | j r| j d¡ | j d¡ | j | jj¡ t | ¡ dS )zAFinalise the macros for a SIP generated module Makefile.
        ZSIP_PROTECTED_IS_PUBLICzprotected=publicN)rp  r=   rr   rA   r¢   r   rY  r
  )ru   ry   ry   rz   r
  {  s
    zSIPModuleMakefile.finalise)Nr   r   r   r   r   r–   r   Nr•   Nr–   r   NNr   N)rƒ   rp   r„   r…   r{   r
  ry   ry   ry   rz   ro  d  s       
ro  c               @   sJ   e Zd ZdZddd„Zdd	„ Zd
d„ Zdd„ Zdd„ Zdd„ Z	dd„ Z
dS )ÚProgramMakefilez2The class that represents a program Makefile.
    Nr   r–   r•   c             C   s^   t  | |||||||	|
||||||¡ || _d|  d¡k| _d| _|rT|  |¡| _nd| _dS )a  Initialise an instance of a program Makefile.

        build_file is the file containing the target specific information.  If
        it is a dictionary instead then its contents are validated.
        install_dir is the directory the target will be installed in.
        Zembed_manifest_exer'   N)r•   r{   r[  rö   r]  r`  r5  rZ  )ru   rÆ   rb  rc  r£   rÇ   rÈ   rÉ   rÊ   rË   rÌ   r¯   rÍ   rÎ   r   r   r   ry   ry   rz   r{   Š  s    
&zProgramMakefile.__init__c             C   st  t j |¡\| _}tjdkr(| jd }n| j}|  ¡  g }| |  d¡¡ x | j	 
¡ D ]}| d| ¡ qVW x |  d¡D ]}| d| ¡ qxW x$|  d¡D ]}| dt|ƒ ¡ qšW | |  d	¡¡ | |  d
¡¡ | jdkrè| |¡ | jdkr| d¡ | d¡ d}n8| jdkr.| d| ¡ d}n| d¡ | |¡ d}xN|  d¡D ]@}tjdkr~| jjr~| dt|ƒ ¡ | |t|ƒ ¡ qRW |  d¡}	| jdkr6g }
x€|	D ]x}xp| 
¡ D ]d}|d dkrèd|dd…  }n|d dkrd|dd…  }|dd…  ¡ dkrÄ|
 |¡ qÄW q¶W |
}	| |	¡ | |  d ¡¡ | jdkrf| |¡ |d! |¡fS )"zºCreate a command line that will build an executable.  Returns a
        tuple of the name of the executable and the command line.

        source is the name of the source file.
        )rœ   rÕ   z.exer)   z-arch r=   z-DrA   z-Ir*   r+   rÙ   )rÜ   zMSVC.NETrÝ   z-Fez/linkz	/LIBPATH:z-ez-Lz-orR   rÔ   z-FrD   éÿÿÿÿú-z-l-r–   r   z-lNéüÿÿÿz.objrU   r  )r¬   r­   r/  r`  rn   r   r:  rr   r  r³   r¸   rö   r  r‰   r»   r¢   r   Úlowerrú   )ru   ÚsourceÚ_Úexer8  r  r%  rE  rF  r  ZblflagsZlfry   ry   rz   Úbuild_command   s`    










zProgramMakefile.build_commandc             C   sX   | j dkr| j d¡ | jr(|  | j¡ | jr4d}nd}| j |  |¡¡ t	 
| ¡ dS )z4Finalise the macros for a program Makefile.
        )rÜ   zMSVC.NETrÝ   z/INCREMENTAL:NOrE   rO   N)r»   rD   rr   r]  r  r`  r£   r‰   rö   r•   r
  )ru   rg  ry   ry   rz   r
  ù  s    
zProgramMakefile.finalisec             C   sz   | j stdƒ‚| j d }tjdkr*|d }| d| ¡ | d| j d  ¡ | d| j d	  ¡ | d
¡ t | |¡ dS )zUGenerate the macros and rules generation.

        mfile is the file object.
        z8pass a filename as build_file when generating a Makefiler  )rœ   rÕ   z.exezTARGET = %s
zOFILES = %s
r,  zHFILES = %s
r)  rM  N)rZ  r  rn   r   r6  r•   r=  )ru   r7  r  ry   ry   rz   r=    s    


z)ProgramMakefile.generate_macros_and_rulesc             C   s   |  d¡ |  d¡ xn| jd  ¡ D ]\}tj |¡\}}d| d }| j| jkr`tj | j|¡}|  d||f ¡ |  d| ¡ q$W |  d¡ | j	d	kr¸|  d
¡ |  d¡ |  d¡ n4| j	dkrâ|  d¡ |  d¡ |  d¡ n
|  d¡ | j
rü|  d¡ dS )zHGenerate the default target.

        mfile is the file object.
        z
all: $(TARGET)
z
$(OFILES): $(HFILES)
r*  r+  z.cppz
%s: %s
z	$(MOC) -o %s $<
z
$(TARGET): $(OFILES)
)rÜ   zMSVC.NETrÝ   z&	$(LINK) $(LFLAGS) /OUT:$(TARGET) @<<
z	  $(OFILES) $(LIBS)
z<<
rÙ   z	$(LINK) @&&|
z+	$(LFLAGS) $(OFILES) ,$(TARGET),,$(LIBS),,
z|
z2	$(LINK) $(LFLAGS) -o $(TARGET) $(OFILES) $(LIBS)
zE	mt -nologo -manifest $(TARGET).manifest -outputresource:$(TARGET);1
N)r6  rZ  r¸   r¬   r­   r/  r±   r¯   rú   r»   r]  )ru   r7  rl  r3  rw  rm  ry   ry   rz   r>    s*    









z'ProgramMakefile.generate_target_defaultc             C   s2   | j dkr| jj| _ | d¡ |  |d| j ¡ dS )zHGenerate the install target.

        mfile is the file object.
        Nz
install: $(TARGET)
z	$(TARGET))r[  r¢   r   r6  r@  )ru   r7  ry   ry   rz   r?  C  s    


z'ProgramMakefile.generate_target_installc             C   s2   |  d¡ |  || j¡ | jr.|  d| j ¡ dS )zFGenerate the clean target.

        mfile is the file object.
        z
clean:
z	-%s $(TARGET).manifest
N)r6  r9  rZ  r]  rÄ   )ru   r7  ry   ry   rz   rA  N  s    
z%ProgramMakefile.generate_target_clean)NNr   r   r   r   r   r–   r   Nr•   NNNN)rƒ   rp   r„   r…   r{   ry  r
  r=  r>  r?  rA  ry   ry   ry   rz   rq  ‡  s      
Y$rq  c             C   s4   t jdkr|  dd¡} |  d¡dkr0d|  d } | S )z^Return a string surrounded by double quotes it if contains a space.

    s is the string.
    rœ   ú/ú\r  r   ú")rn   r   r  r"  )r  ry   ry   rz   r  Z  s
    
r  rj  c             C   sT   t | d? d@ ƒg}|dkrJ| t | d? d@ ƒ¡ |dkrJ| t | d@ ƒ¡ d |¡S )z‹ Convert an n-part version number encoded as a hexadecimal value to a
    string.  version is the version number.  Returns the string.
    rÖ   rØ   r–   r×   r  rÓ   )Ústrrr   rú   )ÚversionÚpartsZ	part_listry   ry   rz   r  i  s    r  c          	   C   s‚   |   d¡}t|tƒsdS t|ƒdkr.| d¡ t|ƒdkr>dS d}x:|D ]2}yt|ƒ}W n tk
rl   dS X |d> | }qHW |S )z§ Convert a version string of the form m.n or m.n.o to an encoded version
    number (or None if it was an invalid format).  version_str is the version
    string.
    rÓ   Nr  Ú0rj  r   r×   )r¸   r‘   r“   rS  rr   Úintr  )Zversion_strr  r~  ÚpartÚvry   ry   rz   Úversion_from_stringy  s    



r„  c             C   s,  |dk	}|dk	}d}d}t | ƒ}| ¡ }	xÖ|	rþ|s6|rþ|	 ¡ }
t|
ƒdkrô|
d dkrô|rÆ|
d |krÆ|
d }|dd… dkrŠt|dƒ}n8t|ƒ}|d	 }|d	 d
 }|d
 }|d> |d>  | }d}|rô|
d |krôd |
dd… ¡dd… }d}| ¡ }	q*W | ¡  |s|r$td|| f ƒ ||fS )a  Read the version information for a package from a file.  The information
    is specified as #defines of a numeric (hexadecimal or decimal) value and/or
    a string value.

    filename is the name of the file.
    description is the descriptive name of the package.
    numdefine is the name of the #define of the numeric version.  It is ignored
    if it is None.
    strdefine is the name of the #define of the string version.  It is ignored
    if it is None.

    Returns a tuple of the version as a number and as a string.
    Nrj  r   z#definer–   r  Z0xrÖ   éd   é
   r×   r  rr  z<The %s version number could not be determined by parsing %s.)r  r!  r¸   rS  r  rú   r#  r    )r0  ÚdescriptionZ	numdefineZ	strdefineZneed_numZneed_strZversZversstrr%  r  Zwlrƒ  ZdecZmajÚminZbugry   ry   rz   Úread_version–  s6    r‰  c          
   C   s  d}t |  ¡ ƒ}| ¡  d}x |D ]}t|ƒ}||k r"|}q"W xæ|D ]Þ}| | }t|ƒ}d}	|dkrjd}nN|t kr‚d |¡}d}	n6|tkr¬| d¡dkr¢d| }q¸t|ƒ}nt|ƒ}d}	|	rÔd|krÈd	}	|	| |	 }|d
 | d d|t|ƒ d   | 	dd¡ }||d kr|d }|d }qDW |d }|d }|r|d }t | ¡ ƒ}
|
 ¡  d}x$|
D ]}t|ƒ}||k rb|}qbW xv|
D ]n}||
d kr d}nd}|| }d|kr¼d	}	nd}	d| d }|dd| d ||	| 	dd¡|	|f  }qˆW |d }n|d }|S )aM  Convert a dictionary to a string (typically to use as the content to a
    call to create_config_module()).  Dictionary values that are strings are
    quoted.  Dictionary values that are lists are converted to quoted strings.

    dict is the dictionary.
    macros is the optional dictionary of platform specific build macros.
    z_pkg_config = {
r   NÚNoner  ú'r~  z0x%06xz'''z    'z':r  r{  z\\rr  ú,rM  z}

z_default_macros = z{
r   z    %-*s  %s%s%s%s
r–   z}
zNone
)
r“   r¶   ÚsortrS  r’   rú   r  r"  r}  r  )Zcdictr   Úcontentr¶   ÚwidthÚkZklenrÐ   ZvtypeZdelimÚnamesÚcZclenÚsepry   ry   rz   Úcreate_contentÍ  sn    




0




.
r”  c             C   sx   t |ƒtkrt||ƒ}d}t| dƒ}t|dƒ}| ¡ }x,|rb| |¡dkrN|}| |¡ | ¡ }q8W | ¡  | ¡  dS )a  Create a configuration module by replacing "@" followed by
    "SIP_CONFIGURATION" followed by "@" in a template file with a content
    string.

    module is the name of the module file.
    template is the name of the template file.
    content is the content string.  If it is a dictionary it is first converted
    to a string using create_content().
    macros is an optional dictionary of platform specific build macros.  It is
    only used if create_content() is called to convert the content to a string.
    z@SIP_CONFIGURATION@r;  r  r   N)r’   r-  r”  r  r!  r"  r6  r#  )ÚmoduleÚtemplaterŽ  r   ÚkeyZdfrH  r&  ry   ry   rz   Úcreate_config_module,	  s    



r˜  c             C   s^   t | ¡ ƒ}| ¡  | dk r*||d  }n0x.|D ]}| |k r0|| }P q0W td|| f ƒ |S )a  Convert a version number to a SIP tag.

    version is the version number.  If it is negative then the latest version
    is assumed.  (This is typically useful if a development preview  is
    indicated by a negative version number.)
    tags is the dictionary of tags keyed by version number.  The tag used is
    the one with the smallest key (ie. earliest version) that is greater than
    the given version number.
    description is the descriptive name of the package used for error messages.

    Returns the corresponding tag.
    r   rr  zUnsupported %s version: 0x%06x.)r“   r¶   r  r    )r~  Ztagsr‡  ZvlÚtagrƒ  ry   ry   rz   Úversion_to_sip_tagN	  s    
rš  c             C   s&   t j td|  ƒd ¡ t  d¡ dS )zWDisplay an error message and terminate.

    msg is the text of the error message.
    zError: rM  r–   N)rn   Ústderrr6  ÚformatÚexit)Úmsgry   ry   rz   r    l	  s    r    c             C   s   t j t| ƒd ¡ dS )zODisplay an information message.

    msg is the text of the error message.
    rM  N)rn   Ústdoutr6  rœ  )rž  ry   ry   rz   Úinformu	  s    r   éN   c             C   sz   |}d| }xh|   ¡ D ]\}t|ƒ}||krJ|| |krJ|d d|  }|}||krb|d }|d }|| }|| }qW |S )zõFormat a message by inserting line breaks at appropriate places.

    msg is the text of the message.
    leftmargin is the position of the left margin.
    rightmargin is the position of the right margin.

    Return the formatted message.
    r  rM  r–   )r¸   rS  )rž  Z
leftmarginZrightmarginZcursZfmsgr;  r  ry   ry   rz   rœ  }	  s    	rœ  c          	   C   s–  i }|dk	rŠx||D ]t}d}|  d¡}|dkr:d}|d }n |  d¡}|dkrV|d }ndS |d|… }	|	|krrdS |||d…  ||	< qW G d	d
„ d
ƒ}
|
| ƒ}tjddddœ}| ¡ }x<|röxFt|ƒdkr|d dkr|dd… }| ¡ }|r|| }qÄP qÄW | dd¡d  ¡ }|rì|  d¡}|dkrX||d  dkrXd}|d }nd}|  d¡}|}|dkrì|d|…  ¡ }||d d…  ¡ }| dd¡ dd¡}|rÜ|dkrÜ| |¡}|dk	rÜ|d | }t	|||ƒ||< | ¡ }q¼W i }x|D ]}d||< qW d}xt
| ¡ ƒD ]ö}| |¡rL|t|ƒd… }n|}||kr^q(|| }ddg}x4|D ](}|  |¡}|dkrt|t|ƒ }P qtW d}xÂ|dkrf||d…   d¡}|dk rÎP || }|||… }	ytj|	 }W n tk
r
   d}Y nX |d|… | ||d d…  }x4|D ](}|  |¡}|dkr2|t|ƒ }P q2W d}q¦W |  d¡}x¢|dkr||d d…   d¡}|dk r P |d | }||d |… }	ytj|	 }W n tk
rä   d}Y nX |d|… | ||d d…  }|  d¡}qtW |||< q(W xlt
| ¡ ƒD ]\}|| }|| }|  d¡dkr€|rr|d |dd…  }n|dd… }n|}|||< q2W |S )aõ  Parse a qmake compatible file of build system macros and convert it to a
    dictionary.  A macro is a name/value pair.  The dictionary is returned or
    None if any of the overrides was invalid.

    filename is the name of the file to parse.
    names is a list of the macro names to extract from the file.
    overrides is an optional list of macro names and values that modify those
    found in the file.  They are of the form "name=value" (in which case the
    value replaces the value found in the file) or "name+=value" (in which case
    the value is appended to the value found in the file).
    properties is an optional dictionary of property name and values that are
    used to resolve any expressions of the form "$[name]" in the file.
    Nr   z+=r   ú+r  r  r–   c               @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )z3parse_build_macros.<locals>.qmake_build_file_readerc             S   s,   || _ d | _g | _g | _d | _|  |¡ d S )N)r0  ÚcurrentfileÚ	filestackÚ	pathstackÚ
cond_fnameÚ	_openfile)ru   r0  ry   ry   rz   r{   Ä	  s    z<parse_build_macros.<locals>.qmake_build_file_reader.__init__c             S   sx   yt |dƒ}W n. tk
r<   | j|kr,d S td| ƒ Y nX | jr`| j | j¡ | j | j¡ || _t	j 
|¡| _d S )Nr  zUnable to open %s)r  r   r¦  r    r£  r¤  rr   r¥  r­   r¬   rù   )ru   r0  r%  ry   ry   rz   r§  Ì	  s    
z=parse_build_macros.<locals>.qmake_build_file_reader._openfilec             S   sà   | j  ¡ }| ¡ }| jr2|dkr2d | _| j  ¡ }nv| d¡rv| d¡rv|  |d d…  ¡ dd…  ¡ ¡| _| j  ¡ }n2| d¡r¨|  |dd…  ¡ ¡}|  |¡ |  ¡ S |sÜ| j  ¡  | j	rÜ| j	 
¡ | _ | j 
¡ | _|  ¡ S |S )NÚ}zexists(Ú{rr  é   zinclude(r×   )r£  r!  r   r¦  r  ÚendswithÚ
_normaliser§  r#  r¤  Úpopr¥  r­   )ru   r&  ZslineZnextfilery   ry   rz   r!  Ý	  s&    
$


z<parse_build_macros.<locals>.qmake_build_file_reader.readlinec             S   s:   d|krt j |  |¡¡}t j |¡s6t j | j|¡}|S )Nz$()r¬   r­   ÚnormpathÚ_expandvarsr.  rú   )ru   r$  ry   ry   rz   r¬  ú	  s
    z>parse_build_macros.<locals>.qmake_build_file_reader._normalisec             S   s‚   d}xxt  d||d … ¡}|s P | d¡\}}| d¡}|tjkrv||d … }|d |… tj|  }t|ƒ}||7 }q|}qW |S )Nr   z\$\((\w+)\)r–   )ÚreÚsearchÚspanÚgroupr¬   ÚenvironrS  )ru   r$  r1  rÏ   Újr~   rX  ry   ry   rz   r¯  
  s    


z?parse_build_macros.<locals>.qmake_build_file_reader._expandvarsN)rƒ   rp   r„   r{   r§  r!  r¬  r¯  ry   ry   ry   rz   Úqmake_build_file_readerÃ	  s
   
r¶  r  ú$r  )ZDIR_SEPARATORZLITERAL_WHITESPACEZLITERAL_DOLLARZLITERAL_HASHéþÿÿÿr{  TFz\"r|  z\'r‹  ZQMAKE_z$$(z$(rr  ú)ú%)r"  r¬   r“  r!  rS  r¸   r   r  ÚgetÚ_expand_macro_valuer“   r¶   r  r´  r|   )r0  r‘  Z	overridesÚ
propertiesZoridesZorider  Zname_endZ	val_startr~   r¶  r%  Úrawr&  ÚnextZassstartZaddingZassendÚlhsÚrhsZorig_rhsZrefinedrÏ   Zmacro_prefixZreflhsZpleadinZplÚestartZnstartZeendÚenvry   ry   rz   Úparse_build_macros™	  sØ    




T














 






 rÄ  c       
      C   s4  |  d¡}|  d¡}x|dkr.||kr.|d }|t|ƒk rZ|| dkrZ|d }d}n,|t|ƒk r€|| dkr€|d }d	}ntj}|}x$|t|ƒk r®|| |kr®|d }qŒW |||… }|d
krÌ|d }|d	krð|dkrâd}	qü| |d¡}	n|  |d¡}	|d|… |	 ||d…  }|  d¡}|  d¡}qW |S )z6Expand the value of a macro based on ones seen so far.z$$(z$$r   r  r©  r–   r¨  ú[ú]z}]Nr   )r"  rS  ÚstringZ
whitespacer»  )
r   rÁ  r½  rÂ  ZmstartZrstartZtermZmendrÀ  rˆ   ry   ry   rz   r¼  ²
  s4    


r¼  c             C   s\  t jdkr|d }t|dƒ}t jdkrTt j}|r@|dd… d }| d|| f ¡ n¾t jdkrôt j}|d	 }|d
 }|rœ|dkrˆ|dks|dkr–d}q d}nd}d|||f }|rÖd dd„ | ¡ D ƒ¡}	d|	|f }| d¡ | d|| f ¡ n| d¡ | dt j| f ¡ | ¡  t jdkrXt	 
|¡}
|
j}|t
jt
jB t
jB O }t	 ||¡ |S )a¸  Create a platform dependent executable wrapper around a Python script.

    script is the full pathname of the script.
    wrapper is the name of the wrapper file to create.
    gui is non-zero if a GUI enabled version of the interpreter should be used.
    use_arch is the MacOS/X architectures to invoke python with.  Several space
    separated architectures may be specified.

    Returns the platform specific name of the wrapper.
    rœ   z.batr;  Nrt  zw.exez/@"%s" "%s" %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9
rÔ   r   r–   rj  r›   rÉ   Zpythonwz%s%d.%dr  c             S   s   g | ]}d | ‘qS )z-%sry   )Ú.0r  ry   ry   rz   ú
<listcomp>  s    z"create_wrapper.<locals>.<listcomp>z
arch %s %sz
#!/bin/sh
zexec %s %s ${1+"$@"}
)rn   r   r  Ú
executabler6  Úversion_inforú   r¸   r#  r¬   ÚstatÚst_modeÚS_IXUSRÚS_IXGRPÚS_IXOTHÚchmod)ZscriptÚwrapperZguiZuse_archZwfrx  r~  Zpy_majorZpy_minorZ
arch_flagsZsbufÚmodery   ry   rz   Úcreate_wrapperÞ
  s@    






rÔ  )rj  )NN)N)N)r   r¡  )NN)r   r   )rn   r¬   rÌ  rÇ  r°  rs   ri   rt   rm   rh   r†   r   r•   rI  rN  rY  ro  rq  r  r  r„  r‰  r”  r˜  rš  r    r   rœ  rÄ  r¼  rÔ  ry   ry   ry   rz   Ú<module>   s*  =+=         B<  9# T

7
_
"	

  ,