PK APOCALYPSE V1

APOCALYPSE V1

Current Path : /opt/alt/alt-nodejs8/root/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/
Upload File :
Current File : //opt/alt/alt-nodejs8/root/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.pyc

�
��Rac@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZd�Zdefd��YZedkr�e
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((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/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�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-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyR&scCs|j�jdd�S(s<Transforms a tool name like copy-info-plist to CopyInfoPlistt-t(ttitletreplace(Rtname_string((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyR.scCs�tjj|�dj�}tjj|�rctjj|�rPtj|�ntj||�nj|dkr|j	||�S|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.storyboards.stringsN(tostpathtsplitexttlowertisdirtexiststshutiltrmtreetcopytreet_CopyXIBFilet_CopyStringsFiletcopy(Rtsourcetdesttconvert_to_binaryt	extension((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pytExecCopyBundleResource2sc

CsFtjjtjjt��}tjj|�rHtjj||�}ntjj|�rrtjj||�}ndddddddd||g
}tjd	�}tjd
�}t	j
|dt	j�}d}xj|j
D]_}	|j|	�r�|	}q�|j|	�s�|r(tj
j|�d}ntj
j|	�q�q�W|jS(
sBCompiles a XIB file with ibtool into a binary plist in the bundle.txcruntibtools--errorss
--warningss	--noticess--output-formatshuman-readable-texts	--compiles/\*.*\*/s .*note:.*is clipping its contenttstdoutN(RRtdirnametrealpatht__file__trelpathtjointretcompilet
subprocesstPopentPIPERR(tmatchRtwritet
returncode(
RR!R"tbaseRtibtool_section_ret	ibtool_ret	ibtoolouttcurrent_section_headertline((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyRGs(		cCs&tjddddd||g�dS(NR&tplutils-converttbinary1s-o(R0t
check_call(RR"((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyt_ConvertToBinaryascCs�|j|�pd}ddl}t|d�j�}|jd|t|��}|jd|dd�\}}	|	rydSt|d�}
|
j|j	|�j
d��|
j�|dkr�|j|�ndS(	sFCopies a .strings file using iconv to reconvert the input into UTF-16.sUTF-8i����NtrbitwbsUTF-16tTrue(
t_DetectInputEncodingtCoreFoundationtopentreadtCFDataCreateRR
tCFPropertyListCreateFromXMLDataR4tdecodetencodetcloseR?(RR!R"R#t
input_codeRDtstdt_terrortfp((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyRes
cCs�t|d�}y|jd�}Wntk
r@|j�dSX|j�|jd�r^dS|jd�rqdS|jd�r�dSdSdS(	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.R@is��sUTF-16s��ssUTF-8N(RERFRRKRt
startswith(Rt	file_nameRQtheader((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyRC|s


c
Gst|d�}|j�}|j�tj|�}|rft|j�tj|d�j��}ntj	|�}t
jd�}x�tj
D]�}	|	jd�r�q�nd|	}
tj
|	}tj||
|�}d|	}
|jdtj
|	�}tj||
|�}d|	}
|jdtj
|	�}tj||
|�}q�W|jd	�}xNtt|��D]:}||j�jd
�rkd||<d||d<qkqkWd	jtd�|��}t|d
�}|j|�|j�|j|�|dkr|j|�ndS(sCCopies the |source| Info.plist to the destination directory |dest|.tris[/\s]ROs${%s}s${%s:identifier}s${%s:rfc1034identifier}Rs
s
<string>${icSs
|dk	S(N(R(tx((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyt<lambda>�RtwRBN(RERFRKtplistlibtreadPlistFromStringtdicttitemstjsontloadstwritePlistToStringR.R/RtenvironRRtstringRtsubtsplittrangeR
tstripRR-tfilterR4t
_WritePkgInfoR?(
RR!R"R#tkeystfdtlinestplisttIDENT_REtkeytevartevalueti((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/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?tPkgInfoRXs%s%ss????(RYt	readPlisttgetR
RRR-R)RER4RK(Rt
info_plistRktpackage_typetsignature_codeR"RQ((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyRg�s
	!cGsFtj|tjtjBtjBd�}tj|tj�tj	|�S(s5Emulates the most basic behavior of Linux's flock(1).i�(
RREtO_RDONLYtO_NOCTTYtO_CREATtfcntltflocktLOCK_EXR0tcall(Rtlockfiletcmd_listRi((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyt	ExecFlock�s&c
Gs3tjd�}tjddd�}tjj�}d|d<tj|dtjd|�}|j�\}}xJ|j	�D]<}|j
|�r||j
|�r|t|d	tj
�q|q|W|js,xdtt|�d
�D]I}	||	dkr�||	d
jd�r�tj||	d
d
�Pq�q�Wn|jS(sQCalls libtool and filters out '/path/to/libtool: file: foo.o has no
    symbols'.s$^.*libtool: 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_DATEtstderrtenvtfileis-os.aN(R.R/RR`R R0R1R2tcommunicatet
splitlinesR3tprintRR�R5RdR
tendswithtutimeR(
RR�t
libtool_retlibtool_re5R�t
libtooloutROterrR;Rp((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pytExecFilterLibtool�s"

 	'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.t.itCurrentt	ResourcestVersionsN(	RRtbasenameRcRR-tgetcwdtchdirt_Relink(Rt	frameworktversiontbinarytCURRENTt	RESOURCEStVERSIONStpwd((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pytExecPackageFrameworks'
""cCs6tjj|�r"tj|�ntj||�dS(sZCreates a symlink to |dest| named |link|. If |link| already exists,
    it is overwritten.N(RRtlexiststremovetsymlink(RR"tlink((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyR�sc

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--errorstIPHONEOS_DEPLOYMENT_TARGETt
CONFIGURATIONRi����tiphoneostiphonesimulators
--platforms--target-devicetiphonetipads--minimum-deployment-targets	--compiletCONTENTS_FOLDER_PATHtmacosxtmactMACOSX_DEPLOYMENT_TARGETt!UNLOCALIZED_RESOURCES_FOLDER_PATHs--N(R�R�(RR`RctextendRtabspathR]R^R\t
isinstancetbooltappendtlisttstrtmapR0R>(
RRhtinputstcommand_linetis_iphone_targettplatformRmtvaluetarg_nametv((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pytExecCompileXcassets&s@		
 




cGsJi}x-|D]%}|j|�}|j||�q
Wtj||�dS(s6Merge multiple .plist files into a single .plist file.N(t_LoadPlistMaybeBinaryt_MergePlistRYt
writePlist(RtoutputR�tmerged_plistRRk((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pytExecMergeInfoPlistZs

c	
Cs�|j|�}|j||j��\}}|j|||�}tjddd|d|d|tjjtj	dtj	d�g	�dS(	s�Code sign a bundle.

    This function tries to code sign an iOS bundle, following the same
    algorithm as Xcode:
      1. copy ResourceRules.plist from the user or the SDK into the bundle,
      2. pick the provisioning profile that best match the bundle identifier,
         and copy it into the bundle as embedded.mobileprovision,
      3. copy Entitlements.plist from user or SDK next to the bundle,
      4. code sign the bundle.
    tcodesigns--forces--signs--resource-ruless--entitlementstTARGET_BUILD_DIRtFULL_PRODUCT_NAMEN(
t_InstallResourceRulest_InstallProvisioningProfilet_GetCFBundleIdentifiert_InstallEntitlementsR0R>RRR-R`(	RRmtresource_rulestentitlementstprovisioningtresource_rules_patht
substitutionst	overridestentitlements_path((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pytExecCodeSignBundlebs		
cCse|}tjjtjdtjdd�}|sQtjjtjdd�}ntj||�|S(s$Installs ResourceRules.plist from user or SDK into the bundle.

    Args:
      resource_rules: string, optional, path to the ResourceRules.plist file
        to use, default to "${SDKROOT}/ResourceRules.plist"

    Returns:
      Path to the copy of ResourceRules.plist into the bundle.
    tBUILT_PRODUCTS_DIRR�sResourceRules.plisttSDKROOT(RRR-R`Rtcopy2(RR�tsource_pathttarget_path((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyR�ys
	

		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.
    R�R�sembedded.mobileprovisionR�tEntitlements(t_FindProvisioningProfileRRR-R`RR�t_GetSubstitutions(Rtprofiletbundle_identifierR�tprovisioning_datatteam_idR�R�((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/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.%sRmcSs
t|�S(N(R
(R�((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyRW�RN(RRR-R`RR�RR�RRRtglobt_LoadProvisioningProfileRxtfnmatchtmax(RR�R�tprofiles_dirtprovisioning_profilestprofile_pathtvalid_provisioning_profilestprofile_datatapp_id_patterntteam_identifiertapp_idtselected_key((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyR��s6	
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(ttempfiletNamedTemporaryFileR0R>tnameR�(RR�ttemp((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/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�R[RxR�(RR�RkRmR�tmerged_value((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/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.
    R<s-converttxml1N(	RYRwR�R�RR�R�R0R>(Rt
plist_pathR�((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/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((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/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.
    R�tINFOPLIST_PATHR(RRR-R`R�(Rtinfo_plist_pathtinfo_plist_data((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyR�s
	
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.xcentR�sEntitlements.plist(
RRR-R`RR�R�t_ExpandVariablesRYR�(RR�R�R�R�R�tdataRm((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyR�)s"	
	

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�(sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pys
<dictcomp>^s	(R�R�R\RR�RR[(RRR�RmR�R�((RRR�sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyRKs#(t__name__t
__module__t__doc__RRR%RR?RRCRqRgR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R(((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyR"s6								9						4					5		
				"t__main__i(R
t
__future__RRR�R�R]RRYR.RRaR0RR�R	tobjectRRRtargv(((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/mac_tool.pyt<module>	s&	��A

if you don't want to be vaporized in a nuclear explosion, i simply have to become nuclear myself… i am atomic