Your IP : 216.73.216.249


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

�
��S]c@sdZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZd�Zdefd��YZd�Zd�Zed	kre
jee
jd
��ndS(s�Utility functions to perform Xcode-style build steps.

These functions are executed via gyp-mac-tool when using the Makefile generator.
i����(tprint_functionNcCs8t�}|j|�}|dk	r4tj|�ndS(N(tMacTooltDispatchtNonetsystexit(targstexecutort	exit_code((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytmains	RcBs
eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�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((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR%scCs|j�jdd�S(s<Transforms a tool name like copy-info-plist to CopyInfoPlistt-t(ttitletreplace(Rtname_string((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR-scCs%|dk}tjj|�dj�}tjj|�rotjj|�r\tj|�ntj||�n�|dkr�|j	||�S|dkr�|j	||�S|dkr�|r�|j
||�n2tjj|�r�tj|�ntj||�|r!|dkr!|j
|�ndS(	stCopies a resource file to the bundle/Resources directory, performing any
    necessary compilation on each resource.tTrueis.xibs.storyboards.stringss.plistN(s.plists.strings(tostpathtsplitexttlowertisdirtexiststshutiltrmtreetcopytreet_CopyXIBFilet_CopyStringsFiletunlinktcopyt_ConvertToBinary(Rtsourcetdesttconvert_to_binaryt	extension((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytExecCopyBundleResource1s"cCs�tjjtjjt��}tjj|�rHtjj||�}ntjj|�rrtjj||�}ndddddg}tjddkr|jdg�d	tjkr�|jd
dd
dd
tjd	g�q|jd
dd
tjdg�n|jddd||g�t	j
d�}t	j
d�}ytj|�}Wn&tj
k
rz}t|j��nXd}	xp|j�D]b}
|
jd�}|j|�r�|}	q�|j|�s�|	r�t|	�d}	nt|�q�q�WdS(sBCompiles a XIB file with ibtool into a binary plist in the bundle.txcruntibtools--errorss
--warningss	--noticestXCODE_VERSION_ACTUALt0700s--auto-activate-custom-fontstIPHONEOS_DEPLOYMENT_TARGETs--target-devicetiphonetipads--minimum-deployment-targettmactMACOSX_DEPLOYMENT_TARGETs--output-formatshuman-readable-texts	--compiles/\*.*\*/s .*note:.*is clipping its contentsutf-8iN(RRtdirnametrealpatht__file__trelpathtjointenvirontextendtretcompilet
subprocesstcheck_outputtCalledProcessErrortprinttoutputRt
splitlinestdecodetmatch(RR$R%tbaseRtibtool_section_ret	ibtool_retstdouttetcurrent_section_headertlinetline_decoded((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyRLsJ

	
	cCs&tjddddd||g�dS(NR)tplutils-converttbinary1s-o(R;t
check_call(RR%((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR#}sc
Cs�|j|�pd}ddl}t|d�j�}|jd|t|��}|jd|dd�\}}|rydSt|d�}	|	j|j	|�j
d��|	j�dS(sFCopies a .strings file using iconv to reconvert the input into UTF-16.sUTF-8i����NtrbitwbsUTF-16(t_DetectInputEncodingtCoreFoundationtopentreadtCFDataCreateRR
tCFPropertyListCreateFromXMLDatatwriteRAtencodetclose(
RR$R%t
input_codeRQtstdt_terrortfp((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR �scCs�t|d�}y|jd�}Wn|j�dSX|j�|jd�rTdS|jd�rgdS|jd�rzdSdSdS(	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.RNis��sUTF-16s��ssUTF-8N(RRRSRXRt
startswith(Rt	file_nameR^theader((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyRP�s

c
Gs�t|d�}|j�}|j�tj|�}|rW|jtj|d��ntj|�}t	j
d�}x�tjD]�}	|	j
d�r�qnd|	}
tj|	}|j|
|�}d|	}
|jdtj|	�}|j|
|�}d|	}
|jdtj|	�}|j|
|�}qW|jd	�}xNtt|��D]:}||j�j
d
�rSd||<d||d<qSqSWd	jtd�|��}t|d
�}|j|�|j�|j|�|dkr�|j|�ndS(sCCopies the |source| Info.plist to the destination directory |dest|.tris[_/\s]R\s${%s}s${%s:identifier}s${%s:rfc1034identifier}Rs
s
<string>${icSs
|dk	S(N(R(tx((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyt<lambda>�RtwRN(RRRSRXtplistlibtreadPlistFromStringtupdatetjsontloadstwritePlistToStringR9R:RR7R_RtsubtsplittrangeR
tstripRR6tfilterRVt
_WritePkgInfoR#(
RR$R%R&tkeystfdtlinestplisttIDENT_REtkeytevartevalueti((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytExecCopyInfoPlist�s@








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?tPkgInfoRes%s%ss????(Rft	readPlisttgetR
RRR6R2RRRVRX(Rt
info_plistRutpackage_typetsignature_codeR%R^((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyRq�s
	!cGsFtj|tjtjBtjBd�}tj|tj�tj	|�S(s5Emulates the most basic behavior of Linux's flock(1).i�(
RRRtO_RDONLYtO_NOCTTYtO_CREATtfcntltflocktLOCK_EXR;tcall(Rtlockfiletcmd_listRs((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyt	ExecFlock�s&cGsBtjd�}tjddd�}tjj�}d|d<tj|dtjd|�}|j�\}}xY|j	�D]K}|j
d	�}	|j|	�r||j|	�r|t|	d
t
j�q|q|W|js;xdtt|�d�D]I}
||
dkr�||
djd
�r�tj||
dd�Pq�q�Wn|jS(sQCalls libtool and filters out '/path/to/libtool: file: foo.o has no
    symbols'.s?^.*libtool: (?:for architecture: \S* )?file: .* has no symbols$s!^.*libtool: warning for library: s".* the table of contents is empty s@\(no object file members in the library define global symbols\)$t1tZERO_AR_DATEtstderrtenvsutf-8tfileis-os.aN(R9R:RR7R"R;tPopentPIPEtcommunicateR@RARBR>RR�t
returncodeRnR
tendswithtutimeR(RR�t
libtool_retlibtool_re5R�t
libtooloutR\terrRIRJRz((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytExecFilterLibtool�s$

 	'cCs�tjj|�jd�d}tjj|d�}tjj|�sVtj|�nd||f}ttjj|d�d�}|j|�|j	�dS(Nt.itModulessUframework module %s {
  umbrella header "%s.h"

  export *
  module * { export * }
}
smodule.modulemapRe(
RRtbasenameRmR6RtmkdirRRRVRX(Rt	frameworktbinarytmodule_pathtmodule_templatetmodule_file((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytExecPackageIosFrameworks

cCs�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.R�itCurrentt	ResourcestVersionsN(	RRR�RmRR6tgetcwdtchdirt_Relink(RR�tversionR�tCURRENTt	RESOURCEStVERSIONStpwd((sK//opt/alt/alt-nodejs16/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(RR%tlink((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR�KscGs�tjj|�jd�d}ttjj|�}i}xC|D];}tjj|�}|||<||tjj||�<qAWt||�dS(NR�i(RRR�RmtmaptabspathR6t	WriteHmap(RtoutR�tall_headerstframework_nametfilelistRatfilename((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyt ExecCompileIosFrameworkHeaderMapRs

cGswtjj|d�}tjj|�s7tj|�nx9|D]1}tj|tjj|tjj|���q>WdS(NtHeaders(RRR6RtmakedirsRR"R�(RR�tcopy_headerstheader_pathRa((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytExecCopyIosFrameworkHeaders\s

c

Gs�ddddddddg}d	tjk}|r�tjd
jd�d}|dkrbd}n|jd|dddddtjd	dtjjtjd�g
�n?|jdddddtjddtjjtjd�g�|r�tj|�}x�|j�D]�\}}d|}t	|t
�rI|r�|j|�q�qt	|t�r�xQ|D]&}	|j|�|jt
|	��q_Wq|j|�|jt
|��qWn|jttjj|��tj|�dS(s�Compiles multiple .xcassets files into a single .car file.

    This invokes 'actool' to compile all the inputs .xcassets files. The
    |keys| arguments is a json-encoded dictionary of extra arguments to
    pass to 'actool' when the asset catalogs contains an application icon
    or a launch image.

    Note that 'actool' does not create the Assets.car file if the asset
    catalogs does not contains imageset.
    R)tactools--output-formatshuman-readable-texts--compress-pngss	--noticess
--warningss--errorsR-t
CONFIGURATIONRi����tiphoneostiphonesimulators
--platforms--target-deviceR.R/s--minimum-deployment-targets	--compiletCONTENTS_FOLDER_PATHtmacosxR0R1t!UNLOCALIZED_RESOURCES_FOLDER_PATHs--N(R�R�(RR7RmR8RR�RiRjtitemst
isinstancetbooltappendtlisttstrR�R;RM(
RRrtinputstcommand_linetis_iphone_targettplatformRwtvaluetarg_nametv((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytExecCompileXcassetscs@		
 




cGsJi}x-|D]%}|j|�}|j||�q
Wtj||�dS(s6Merge multiple .plist files into a single .plist file.N(t_LoadPlistMaybeBinaryt_MergePlistRft
writePlist(RR?R�tmerged_plistRRu((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytExecMergeInfoPlist�s

c
Cs�|j||j��\}}|j|||�}ddd|g}	|dkrg|	jddg�n|	jd|g�|	jd|g�tj|	�d	S(
smCode sign a bundle.

    This function tries to code sign an iOS bundle, following the same
    algorithm as Xcode:
      1. pick the provisioning profile that best match the bundle identifier,
         and copy it into the bundle as embedded.mobileprovision,
      2. copy Entitlements.plist from user or SDK next to the bundle,
      3. code sign the bundle.
    tcodesigns--forces--signRs--deeps+--preserve-metadata=identifier,entitlementss--entitlementss--timestamp=noneN(t_InstallProvisioningProfilet_GetCFBundleIdentifiert_InstallEntitlementsR8R;RM(
RRwtentitlementstprovisioningRtpreservet
substitutionst	overridestentitlements_pathR((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytExecCodeSignBundle�s
cCsu|j||�\}}}tjjtjdtjdd�}tj||�|j||d�}||dfS(s�Installs embedded.mobileprovision into the bundle.

    Args:
      profile: string, optional, short name of the .mobileprovision file
        to use, if empty or the file is missing, the best file installed
        will be used
      bundle_identifier: string, value of CFBundleIdentifier from Info.plist

    Returns:
      A tuple containing two dictionary: variables substitutions and values
      to overrides when generating the entitlements file.
    tBUILT_PRODUCTS_DIRR�sembedded.mobileprovisionR�tEntitlements(t_FindProvisioningProfileRRR6R7Rtcopy2t_GetSubstitutions(Rtprofiletbundle_identifiertsource_pathtprovisioning_datatteam_idttarget_pathR�((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR��s
	

	cCs�tjjtjdddd�}tjj|�s[td|dtj�tjd�nd}|r�tjj||d�}tjj
|�r�|g}q�n|s�tjtjj|d	��}ni}x�|D]�}|j|�}|j
d
i�j
dd�}xR|j
d
g�D]>}	d|	|f}
tj|
|�r|||	f||<qqWq�W|s�td|dtj�tjd�nt|dd��}||S(s/Finds the .mobileprovision file to use for signing the bundle.

    Checks all the installed provisioning profiles (or if the user specified
    the PROVISIONING_PROFILE variable, only consult it) and select the most
    specific that correspond to the bundle identifier.

    Args:
      profile: string, optional, short name of the .mobileprovision file
        to use, if empty or the file is missing, the best file installed
        will be used
      bundle_identifier: string, value of CFBundleIdentifier from Info.plist

    Returns:
      A tuple of the path to the selected provisioning profile, the data of
      the embedded plist in the provisioning profile and the team identifier
      to use for code signing.

    Raises:
      SystemExit: if no .mobileprovision can be used to sign the bundle.
    tHOMEtLibrarytMobileDevicesProvisioning Profiless&cannot find mobile provisioning for %sR�is.mobileprovisions*.mobileprovisionR�sapplication-identifierRtTeamIdentifiers%s.%sRwcSs
t|�S(N(R
(R�((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyRdRN(RRR6R7RR>RR�RRRtglobt_LoadProvisioningProfileR�tfnmatchtmax(RR�R�tprofiles_dirtprovisioning_profilestprofile_pathtvalid_provisioning_profilestprofile_datatapp_id_patterntteam_identifiertapp_idtselected_key((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR��s>	




cCsNtj��<}tjdddd|d|jg�|j|j�SWdQXdS(s�Extracts the plist embedded in a provisioning profile.

    Args:
      profile_path: string, path to the .mobileprovision file

    Returns:
      Content of the plist embedded in the provisioning profile as a dictionary.
    tsecuritytcmss-Ds-is-oN(ttempfiletNamedTemporaryFileR;RMtnameR�(RRttemp((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR�s	cCs�x~|j�D]p\}}t|t�rs|j|i�}t|t�rf|j||�|||<q}|||<q
|||<q
WdS(s"Merge |plist| into |merged_plist|.N(R�R�tdictR�R�(RR�RuRwR�tmerged_value((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR�s

c	Cssytj|�SWnnXtj��F}tj||j�tjddd|jg�tj|j�SWdQXdS(s}Loads into a memory a plist possibly encoded in binary format.

    This is a wrapper around plistlib.readPlist that tries to convert the
    plist to the XML format if it can't be parsed (assuming that it is in
    the binary format).

    Args:
      plist_path: string, path to a plist file, in XML or binary format

    Returns:
      Content of the plist as a dictionary.
    RKs-converttxml1N(	RfR�RRRR�R
R;RM(Rt
plist_pathR((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR�!s
cCsi|d6|d6S(sFConstructs a dictionary of variable substitutions for Entitlements.plist.

    Args:
      bundle_identifier: string, value of CFBundleIdentifier from Info.plist
      app_identifier_prefix: string, value for AppIdentifierPrefix

    Returns:
      Dictionary of substitutions to apply when generating Entitlements.plist.
    tCFBundleIdentifiertAppIdentifierPrefix((RR�tapp_identifier_prefix((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR�:s
cCs:tjjtjdtjd�}|j|�}|dS(s�Extracts CFBundleIdentifier value from Info.plist in the bundle.

    Returns:
      Value of CFBundleIdentifier in the Info.plist located in the bundle.
    tTARGET_BUILD_DIRtINFOPLIST_PATHR(RRR6R7R�(Rtinfo_plist_pathtinfo_plist_data((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR�Is
	
cCs�|}tjjtjdtjdd�}|sRtjjtjdd�}ntj||�|j|�}|j||�}|r�x.|D]#}||kr�||||<q�q�Wntj	||�|S(s[Generates and install the ${BundleName}.xcent entitlements file.

    Expands variables "$(variable)" pattern in the source entitlements file,
    add extra entitlements defined in the .mobileprovision file and the copy
    the generated plist to "${BundlePath}.xcent".

    Args:
      entitlements: string, optional, path to the Entitlements.plist template
        to use, defaults to "${SDKROOT}/Entitlements.plist"
      substitutions: dictionary, variable substitutions
      overrides: dictionary, values to add to the entitlements

    Returns:
      Path to the generated entitlements file.
    R�tPRODUCT_NAMEs.xcenttSDKROOTsEntitlements.plist(
RRR6R7RR�R�t_ExpandVariablesRfR�(RR�R�R�R�R�tdataRw((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR�Us"	
	

cs�t�t�rFx0�j�D]"\}}�jd||��qW�St�t�rxg�D]}�j|��^q\St�t�r����fd��D�S�S(szExpands variables "$(variable)" in data.

    Args:
      data: object, can be either string, list or dictionary
      substitutions: dictionary, variable substitutions to perform

    Returns:
      Copy of data where each references to "$(variable)" has been replaced
      by the corresponding value found in substitutions, or left intact if
      the key was not found.
    s$(%s)cs)i|]}�j�|��|�qS((R(t.0tk(RRR�(sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pys
<dictcomp>�s	(R�R�R�RR�RR(RRR�RwR�R�((RRR�sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyRws#(t__name__t
__module__t__doc__RRR(RR#R RPR{RqR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R(((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR!s:				1				9							
		4				9		
				"cCsd|j�S(Ni(t
bit_length(Rc((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pytNextGreaterPowerOf2�sc
Cs)d}d}d}t|�}t|�}dd|}tt|j�dd��d�}t|d�}	|	jtjd	|||||||��dg|}
x�|j�D]~\}}d}
x(|D] }|
t	|j
��d
7}
q�Wx&|
|
|d@dk	r|
d}
q�W||f|
|
|d@<q�Wd}x�|
D]�}|dkrt|	jtjdddd��q@|\}}|}|t|�d}|ttjj
|�tj�d}|ttjj|��d}|	jtjd|||��q@W|	jtjd��x|
D]}|dk	r!|\}}|	jtjd
t|�|��|	jtjdd��tjj
|�tj}|	jtjd
t|�|��|	jtjdd��tjj|�}|	jtjd
t|�|��|	jtjdd��q!q!WdS(sGenerates a header map based on |filelist|.

  Per Mark Mentovai:
    A header map is structured essentially as a hash table, keyed by names used
    in #includes, and providing pathnames to the actual files.

  The implementation below and the comment above comes from inspecting:
    http://www.opensource.apple.com/source/distcc/distcc-2503/distcc_dist/include_server/headermap.py?txt
  while also looking at the implementation in clang in:
    https://llvm.org/svn/llvm-project/cfe/trunk/lib/Lex/HeaderMap.cpp
  ipamhiiiiRwcSst|d�S(Ni(R
(tt((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyRd�RROs<LHHLLLLi
s<LLLs<xs<%dss<ssN(R
R$R�R�RRRVtstructtpackRtordRRRR2tsepR�(toutput_nameR�tmagicR�t	_reservedtcounttcapacitytstrings_offsettmax_value_lengthR�tbucketsR�RRwtctnext_offsettbuckett
key_offsett
prefix_offsett
suffix_offsetRC((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyR��sP%


"' #
###t__main__i(R"t
__future__RR�R�R�RiRRfR9RR&R;RRR	tobjectRR$R�R Rtargv(((sK//opt/alt/alt-nodejs16/root/usr/lib/python2.7/site-packages/gyp/mac_tool.pyt<module>s*	��n		?