Your IP : 216.73.216.213


Current Path : /opt/alt/alt-nodejs9/root/lib/python2.7/site-packages/gyp/
Upload File :
Current File : //opt/alt/alt-nodejs9/root/lib/python2.7/site-packages/gyp/mac_tool.pyo

�
 ]vQc@s�dZddlZddlZddlZddlZddlZddlZddlZddlZd�Z	de
fd��YZedkr�ej
e	ejd��ndS(s�Utility functions to perform Xcode-style build steps.

These functions are executed via gyp-mac-tool when using the Makefile generator.
i����NcCs8t�}|j|�}|dk	r4tj|�ndS(N(tMacTooltDispatchtNonetsystexit(targstexecutort	exit_code((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytmains	RcBszeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�ZRS(
s�This class performs all the Mac tooling steps. The methods can either be
  executed directly, or dispatched from an argument list.cCsOt|�dkr!td��nd|j|d�}t||�|d�S(s(Dispatches a string command to a method.isNot enough argumentssExec%si(tlent	Exceptiont_CommandifyNametgetattr(tselfRtmethod((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyRscCs|j�jdd�S(s<Transforms a tool name like copy-info-plist to CopyInfoPlistt-t(ttitletreplace(R
tname_string((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR'scCs�tjj|�dj�}tjj|�rctjj|�rPtj|�ntj||�nK|dkr|j	||�S|dkr�|j
||�ntj||�dS(stCopies a resource file to the bundle/Resources directory, performing any
    necessary compilation on each resource.is.xibs.stringsN(tostpathtsplitexttlowertisdirtexiststshutiltrmtreetcopytreet_CopyXIBFilet_CopyStringsFiletcopyfile(R
tsourcetdestt	extension((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytExecCopyBundleResource+sc
	Cs�tjjdd�}tjj|d�dddddd	||g	}tjd
�}tjd�}tj|dtj	�}d
}xj|jD]_}	|j|	�r�|	}q�|j|	�s�|r�t
jj|�d
}nt
jj|	�q�q�W|jS(sBCompiles a XIB file with ibtool into a binary plist in the bundle.tDEVELOPER_BIN_DIRs/usr/bintibtools--errorss
--warningss	--noticess--output-formatshuman-readable-texts	--compiles/\*.*\*/s .*note:.*is clipping its contenttstdoutN(RtenvirontgetRtjointretcompilet
subprocesstPopentPIPERR&tmatchRtwritet
returncode(
R
R R!t	tools_dirRtibtool_section_ret	ibtool_ret	ibtoolouttcurrent_section_headertline((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR;s"		cCs�|j|�pd}ddl}t|�j�}|jd|t|��}|jd|dd�\}}|rvdSt|d�}	dd|dd	|g}
tj	|
d
|	�|	j
�dS(sFCopies a .strings file using iconv to reconvert the input into UTF-16.sUTF-8i����Nitws/usr/bin/iconvs--from-codes	--to-codesUTF-16R&(t_DetectInputEncodingtCoreFoundationtopentreadtCFDataCreateRR	tCFPropertyListCreateFromXMLDataR,tcalltclose(R
R R!t
input_codeR:tstdt_terrortfpR((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyROscCs�t|d�}y|jd�}Wntk
r@|j�d	SX|j�|jd�r^dS|jd�rqdS|jd�r�dSd	Sd	S(
s�Reads the first few bytes from file_name and tries to guess the text
    encoding. Returns None as a guess if it can't detect it.trbis��sUTF-16BEs��sUTF-16LEssUTF-8N(R;R<teR@Rt
startswith(R
t	file_nameRFtheader((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR9es


cCs�t|d�}|j�}|j�xLtjD]A}|jd�rJq/nd|}tj||tj|�}q/Wt|d�}|j|�|j�|j	|�dS(sCCopies the |source| Info.plist to the destination directory |dest|.trRDs${%s}R8N(
R;R<R@RR'RItstringRR0t
_WritePkgInfo(R
R R!tfdtlinestkeytevar((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytExecCopyInfoPlistxs

 

cCs�tj|�}|sdS|d}|dkr3dS|jdd�}t|�dkr`d}ntjjtjj|�d�}t|d	�}|j	d
||f�|j
�dS(s@This writes the PkgInfo file from the data stored in Info.plist.NtCFBundlePackageTypetAPPLtCFBundleSignatures????it?tPkgInfoR8s%s%ss????(tplistlibt	readPlistR(R	RRR)tdirnameR;R0R@(R
t
info_plisttplisttpackage_typetsignature_codeR!RF((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyRN�s
	!cGsFtj|tjtjBtjBd�}tj|tj�tj	|�S(s5Emulates the most basic behavior of Linux's flock(1).i�(
RR;tO_RDONLYtO_NOCTTYtO_CREATtfcntltflocktLOCK_EXR,R?(R
tlockfiletcmd_listRO((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyt	ExecFlock�s&cGsvtjd�}tj|dtj�}|j�\}}x3|j�D]%}|j|�sFtj	|IJqFqFW|j
S(sDCalls libtool and filters out 'libtool: file: foo.o has no symbols'.s"^libtool: file: .* has no symbols$tstderr(R*R+R,R-R.tcommunicatet
splitlinesR/RRiR1(R
Rgt
libtool_ret
libtooloutRDterrR7((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytExecFilterLibtool�scCs�tjj|�jd�d}d}d}d}tjjtjj||||��s\dStj�}tj|�|j|tjj||��|jtjj|||�|�|jtjj|||�|�tj|�dS(seTakes a path to Something.framework and the Current version of that and
    sets up all the symlinks.t.itCurrentt	ResourcestVersionsN(	RRtbasenametsplitRR)tgetcwdtchdirt_Relink(R
t	frameworktversiontbinarytCURRENTt	RESOURCEStVERSIONStpwd((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytExecPackageFramework�s'
""cCs6tjj|�r"tj|�ntj||�dS(sZCreates a symlink to |dest| named |link|. If |link| already exists,
    it is overwritten.N(RRtlexiststremovetsymlink(R
R!tlink((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyRx�s(t__name__t
__module__t__doc__RRR#RRR9RSRNRhRoR�Rx(((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyRs										
	t__main__i(R�RcRRYR*RRMR,RRtobjectRR�Rtargv(((sJ//opt/alt/alt-nodejs9/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyt<module>s	�