HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1780863/root/usr/lib/python3/dist-packages/gyp/__pycache__/
Upload File :
Current File : //proc/1780863/root/usr/lib/python3/dist-packages/gyp/__pycache__/mac_tool.cpython-311.pyc
�

�"Kb6j���dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZd�ZGd�de��Zd�Zd�Zed	kr(e
jee
jd
d�����dSdS)z�Utility functions to perform Xcode-style build steps.

These functions are executed via gyp-mac-tool when using the Makefile generator.
�)�print_functionNc�|�t��}|�|��}|�tj|��dSdS�N)�MacTool�Dispatch�sys�exit)�args�executor�	exit_codes   �./usr/lib/python3/dist-packages/gyp/mac_tool.py�mainrsB��
�Y�Y�(�����%�%�)����H�Y��������c��eZdZdZd�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�Zd�ZdS)rz�This class performs all the Mac tooling steps. The methods can either be
  executed directly, or dispatched from an argument list.c��t|��dkrtd���d|�|d��z}t||��|dd��S)z(Dispatches a string command to a method.�zNot enough argumentszExec%srN)�len�	Exception�_CommandifyName�getattr)�selfr
�methods   r
rzMacTool.Dispatch&s[��
�4�y�y�1�}�}��,�-�-�-�
��,�,�T�!�W�5�5�
5�F� �7�4�� � �$�q�r�r�(�+�+rc�R�|����dd��S)z<Transforms a tool name like copy-info-plist to CopyInfoPlist�-�)�title�replace)r�name_strings  r
rzMacTool._CommandifyName.s$�������&�&�s�B�/�/�/rc���|dk}tj�|��d���}tj�|��rItj�|��rt
j|��t
j||��n�|dkr|�	||��S|dkr|�	||��S|dkr|s|�
||��nHtj�|��rtj|��t
j||��|r|dvr|�
|��dSdSdS)ztCopies a resource file to the bundle/Resources directory, performing any
    necessary compilation on each resource.�Truerz.xibz.storyboard�.strings)z.plistr!N)�os�path�splitext�lower�isdir�exists�shutil�rmtree�copytree�_CopyXIBFile�_CopyStringsFile�unlink�copy�_ConvertToBinary)r�source�dest�convert_to_binary�	extensions     r
�ExecCopyBundleResourcezMacTool.ExecCopyBundleResource2sf��*�V�3���� � ��(�(��+�1�1�3�3�I�	�w�}�}�V��� �

�����	�	���
�d�����o�f�d�#�#�#�#�	�f�	�	�
�
�
�v�t�
,�
,�,�	�m�	#�	#�
�
�
�v�t�
,�
,�,�	�j�	 �	 �):�	 �
���F�D�)�)�)�)�	�����	�	��
�	�$�����k�&�$�����"�Y�*@�@�@�
���D�!�!�!�!�!�"�"�@�@rc	��tj�tj�t����}tj�|��r tj�||��}tj�|��r tj�||��}gd�}tjddkry|�dg��dtjvr,|�ddddd	tjdg��n)|�dd
d	tjdg��|�dd
d||g��tj
d��}tj
d��}	tj|��}n,#tj
$r}t|j���d}~wwxYwd}	|���D]f}
|
�d��}|�|��r|}	�/|�|��s"|	rt|	��d}	t|���gdS)zBCompiles a XIB file with ibtool into a binary plist in the bundle.)�xcrun�ibtool�--errors�
--warnings�	--notices�XCODE_VERSION_ACTUAL�0700z--auto-activate-custom-fonts�IPHONEOS_DEPLOYMENT_TARGET�--target-device�iphone�ipad�--minimum-deployment-target�mac�MACOSX_DEPLOYMENT_TARGET�--output-format�human-readable-text�	--compilez/\*.*\*/z .*note:.*is clipping its contentN�utf-8r)r"r#�dirname�realpath�__file__�relpath�join�environ�extend�re�compile�
subprocess�check_output�CalledProcessError�print�output�
splitlines�decode�match)rr0r1�baser
�ibtool_section_re�	ibtool_re�stdout�e�current_section_header�line�line_decodeds            r
r+zMacTool._CopyXIBFileMsS���7�?�?�2�7�+�+�H�5�5�6�6�D�	�w���v���*��w�|�|�D�&�)�)�f�	�w���t���&�
�W�\�\�$��
%�
%�d�E�E�E�D�	�z�(�)�F�2�2�
�k�k�1�2�3�3�3�	%���	3�	3�����x�):�F�)��J�3�4�
�	�	�	�	�	
����u�)��J�1�2�
�	�	�	�	�K�K�"�$9�;��������
�;�/�/���
�>�?�?�I���&�t�,�,�f�f���(�����A�H�o�o�o����������"���!�!�#�#�����[�[��)�)�l�	�	 �	 ��	.�	.��!-������|�,�,��!�	(�
�&�
'�
'�
'�#'�
 �
�l������1s�F+�+G�:G�Gc	�<�tjddddd||g��dS)Nr6�plutil�-convert�binary1�-o)rQ�
check_call)rr1s  r
r/zMacTool._ConvertToBinary~s;������:�y�$��d�D�E�E�E�E�Erc���|�|��pd}ddl}t|d�����}|�d|t|����}|�d|dd��\}}|rdSt|d��}	|	�|�|���	d����|	�
��dS)zFCopies a .strings file using iconv to reconvert the input into UTF-16.�UTF-8rN�rb�wb�UTF-16)�_DetectInputEncoding�CoreFoundation�open�read�CFDataCreater�CFPropertyListCreateFromXMLData�writerW�encode�close)
rr0r1�
input_coderm�s�d�_�error�fps
          r
r,zMacTool._CopyStringsFile�s����*�*�6�2�2�=�g�J������V�T�����!�!�A��#�#�D�!�S��V�V�4�4�A��=�=�d�A�q�$�O�O�H�A�u��
��f�	
�d�D�	�	�B��H�H�Q�X�X�j�
!�
!�
(�
(��
2�
2�3�3�3��H�H�J�J�J�J�Jrc�>�t|d��}	|�d��}n#|���YdSxYw|���|�d��rdS|�d��rdS|�d��rdSdS)	z�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.ri�Ns��rks��srh)rnrort�
startswith)r�	file_namerz�headers    r
rlzMacTool._DetectInputEncoding�s���
�i��	�	�B���w�w�q�z�z�f�f����h�h�j�j�j�
�T�T�����H�H�J�J�J�
����%�%��
�X�	�	�	�;�	'�	'��
�X�	�	�	�?�	+�	+��
�W�
�Ts	�(�Ac���t|d��}|���}|���tj|��}|r-|�t
j|d����tj|��}tj
d��}tjD]�}	|	�
d��r�d|	z}
tj|	}|�|
|��}d|	z}
|�dtj|	��}|�|
|��}d|	z}
|�dtj|	��}|�|
|��}��|�d	��}t#t%|����D]<}||����
d
��r
d||<d||dz
<�=d	�t+d
�|����}t|d��}|�|��|���|�|��|dkr|�|��dSdS)zCCopies the |source| Info.plist to the destination directory |dest|.�rrz[_/\s]rxz${%s}z${%s:identifier}z${%s:rfc1034identifier}r�
z
<string>${Nrc�
�|duSr���xs r
�<lambda>z+MacTool.ExecCopyInfoPlist.<locals>.<lambda>�s
��q��}�r�wr )rnrort�plistlib�readPlistFromString�update�json�loads�writePlistToStringrOrPr"rMr}r�sub�split�ranger�striprL�filterrr�
_WritePkgInfor/)
rr0r1r2�keys�fd�lines�plist�IDENT_RE�key�evar�evalue�is
             r
�ExecCopyInfoPlistzMacTool.ExecCopyInfoPlist�s?��
�f�c�	�	�B��G�G�I�I�E��H�H�J�J�J�
�(��/�/�E��(��l�l�4�:�d�1�g�&�&�'�'�'��'��.�.�E��z�)�$�$�H��z�*�*��	����	�	���
�s�]�d��z�#��f��m�m�D�&�)�)�e� �#�
%�d��|�|�C���C��1�1�f��m�m�D�&�)�)�e�
&��
,�d��|�|�C���C��1�1�f��m�m�D�&�)�)�e�e�
�K�K����E�
�3�u�:�:�
�
����	�q����	�	�	$�	$�\�	2�	2����a����a�!�e����I�I�f�4�4�e�<�<�=�=�E�
�d�C���B��H�H�U�O�O�O��H�H�J�J�J�	���t�����F�"�"�
���D�!�!�!�!�!�#�"rc��tj|��}|sdS|d}|dkrdS|�dd��}t|��dkrd}tj�tj�|��d��}t|d��}|�	|�|����|�
��dS)	z@This writes the PkgInfo file from the data stored in Info.plist.N�CFBundlePackageType�APPL�CFBundleSignaturez????��PkgInfor�)r��	readPlist�getrr"r#rLrHrnrrrt)r�
info_plistr��package_type�signature_coder1rzs       r
r�zMacTool._WritePkgInfo�s�����z�*�*�E��
��f��.�/�L��v����f�
�Y�Y�2�F�;�;�N�
�>���a����n�
�7�<�<�����
�3�3�Y�?�?�D�	
�d�C���B��H�H�|�|�^�^�
4�5�5�5��H�H�J�J�J�J�Jrc���tj|tjtjztjzd��}tj|t
j��tj	|��S)z5Emulates the most basic behavior of Linux's flock(1).i�)
r"rn�O_RDONLY�O_NOCTTY�O_CREAT�fcntl�flock�LOCK_EXrQ�call)r�lockfile�cmd_listr�s    r
�	ExecFlockzMacTool.ExecFlock�sK��
���2�;�r�{�2�2�:�=�u�	E�	E�B�	�K��E�M�"�"�"��?�8�$�$�$rc���tjd��}tjd��}tj���}d|d<tj|t
j|���}|���\}}|�	��D]\}|�
d��}	|�|	��s0|�|	��st|	tj����]|jslt!t#|��dz
��D]L}
||
d	kr>||
dz�d
��r tj||
dzd��n�M|jS)zQCalls libtool and filters out '/path/to/libtool: file: foo.o has no
    symbols'.z?^.*libtool: (?:for architecture: \S* )?file: .* has no symbols$z�^.*libtool: warning for library: .* the table of contents is empty \(no object file members in the library define global symbols\)$�1�ZERO_AR_DATE)�stderr�envrG��filerrez.aN)rOrPr"rMr.rQ�Popen�PIPE�communicaterVrWrXrTrr��
returncoder�r�endswith�utime)rr��
libtool_re�libtool_re5r��
libtooloutrx�errr_r`r�s           r
�ExecFilterLibtoolzMacTool.ExecFilterLibtoolsm����8�9�9�J��*�	L�M�M�K�
�*�/�/�
�
�C�
�C����!�(�:�?��L�L�L�J�
�
#�
#�
%�
%�F�A�s���� � �-�-���[�[��)�)�l�
�
�
�l�
+�
+�-�K�4E�4E�l�4S�4S�-�
�l���,�,�,�,��� ���S��]�]�Q�&�'�'���!��A�;�$���8�A�a�C�=�#9�#9�$�#?�#?��
�(�8�A�a�C�=�$�
'�
'�
'�
�%��� � rc���tj�|���d��d}tj�|d��}tj�|��stj|��d|�d|�d�}ttj�|d��d��}|�|��|�	��dS)	N�.r�Moduleszframework module z {
  umbrella header "z*.h"

  export *
  module * { export * }
}
zmodule.modulemapr�)
r"r#�basenamer�rLr'�mkdirrnrrrt)r�	framework�binary�module_path�module_template�module_files      r
�ExecPackageIosFrameworkzMacTool.ExecPackageIosFrameworks���
�W�
�
�i�
(�
(�
.�
.�s�
3�
3�A�
6�F��'�,�,�y�)�4�4�K�
�7�>�>�+�&�&���h�{����� &�v�v�v�v�v�/�O��r�w�|�|�K�1C�D�D�c�J�J�K����o�&�&�&��������rc��tj�|���d��d}d}d}d}tj�tj�||||����sdStj��}tj|��|�|tj�||����|�tj�|||��|��|�tj�|||��|��tj|��dS)zeTakes a path to Something.framework and the Current version of that and
    sets up all the symlinks.r�r�Current�	Resources�VersionsN)	r"r#r�r�r'rL�getcwd�chdir�_Relink)rr��versionr��CURRENT�	RESOURCES�VERSIONS�pwds        r
�ExecPackageFrameworkzMacTool.ExecPackageFramework/s���W�
�
�i�
(�
(�
.�
.�s�
3�
3�A�
6�F��G��I��H�
�7�>�>�"�'�,�,�y�(�G�V�L�L�M�M�
�
�f�
�)�+�+�C��H�Y����	�L�L��"�'�,�,�x��9�9�:�:�:�	�L�L�����h���8�8�&�A�A�A��L�L�����h���;�;�Y�G�G�G��H�S�M�M�M�M�Mrc��tj�|��rtj|��tj||��dS)zZCreates a symlink to |dest| named |link|. If |link| already exists,
    it is overwritten.N)r"r#�lexists�remove�symlink)rr1�links   r
r�zMacTool._RelinkLs?��
�w���t�����i��o�o�o��J�t�T�����rc�p�tj�|���d��d}t	tjj|��}i}|D]I}tj�|��}|||<||tj�||��<�Jt||��dS)Nr�r)r"r#r�r��map�abspathrL�	WriteHmap)r�outr��all_headers�framework_name�filelistr�filenames        r
� ExecCompileIosFrameworkHeaderMapz(MacTool.ExecCompileIosFrameworkHeaderMapSs����W�%�%�i�0�0�6�6�s�;�;�A�>�N��b�g�o�{�3�3�K��H��@�@����!�!�&�)�)�h�!�h�x��9?�h�r�w�|�|�N�H�5�5�6�6�
�c�8�����rc
�V�tj�|d��}tj�|��stj|��|D]R}tj|tj�|tj�|�������SdS)N�Headers)r"r#rLr'�makedirsr(r.r�)rr��copy_headers�header_pathrs     r
�ExecCopyIosFrameworkHeadersz#MacTool.ExecCopyIosFrameworkHeaders]s����'�,�,�y�)�4�4�K�
�7�>�>�+�&�&���k�+�����O�O���k�&�"�'�,�,�{�B�G�4D�4D�V�4L�4L�M�M�N�N�N�N�O�Orc�`�gd�}dtjv}|r�tjd�d��d}|dvrd}|�d|d	d
d	ddtjdd
tj�tjd��g
��nZ|�ddd	ddtjdd
tj�tjd��g��|r�t
j|��}|���D]�\}}d|z}t|t��r|r|�|���7t|t��r=|D]9}	|�|��|�t|	�����:��|�|��|�t|������|�ttjj|����tj|��dS)a�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.
    )r6�actoolrDrEz--compress-pngsr:r9r8r=�
CONFIGURATIONr���)�iphoneos�iphonesimulatorr�z
--platformr>r?r@rArF�CONTENTS_FOLDER_PATH�macosxrBrC�!UNLOCALIZED_RESOURCES_FOLDER_PATHz--N)r"rMr�rNr#r�r�r��items�
isinstance�bool�append�list�strr�rQrf)
rr��inputs�command_line�is_iphone_target�platformr��value�arg_name�vs
          r
�ExecCompileXcassetszMacTool.ExecCompileXcassetsds7�����L�4�r�z�A���	���O�,�2�2�3�7�7��;�h�	�8�	8�	8�$�����
��"3�X�
�V�%B�
�*�1�
2�K�
�'�/�/�"�*�%;�<�
=�
=�	�	�	�	�	����
��"3�U�
'���4N�)O�
�
�'�/�/�"�*�%H�I�
J�
J�	�	�	�	��
*�
�Z��
�
�d��
�
���*�*�*�#�u��#�:���e�T�"�"�		*�
�*�����)�)�)��
��t�
$�
$�	*��(�(�a�����)�)�)�����A���'�'�'�'�(��
�
�h�
'�
'�
'�
�
�
�c�%�j�j�
)�
)�
)�
)�����B�G�O�V�4�4�5�5�5���,�'�'�'�'�'rc��i}|D]-}|�|��}|�||���.tj||��dS)z6Merge multiple .plist files into a single .plist file.N)�_LoadPlistMaybeBinary�_MergePlistr��
writePlist)rrUr�merged_plistr#r�s      r
�ExecMergeInfoPlistzMacTool.ExecMergeInfoPlist�s[���L��,�,���(�(��.�.�e�
���|�U�+�+�+�+����f�-�-�-�-�-rc�V�|�||�����\}}|�|||��}ddd|g}	|dkr|	�ddg��n|	�d|g��|	�d|g��t	j|	��d	S)
amCode 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.
    �codesignz--forcez--signr z--deepz+--preserve-metadata=identifier,entitlementsz--entitlementsz--timestamp=noneN)�_InstallProvisioningProfile�_GetCFBundleIdentifier�_InstallEntitlementsrNrQrf)
rr��entitlements�provisioningr#�preserve�
substitutions�	overrides�entitlements_pathr
s
          r
�ExecCodeSignBundlezMacTool.ExecCodeSignBundle�s��� $�?�?��d�1�1�3�3� 5� 5��M�9��1�1��m�Y�0�0��
�	�8�S�1�D��6���
�k�k�8�J�K�L�L�L�L�
�k�k�#�%6�7�8�8�8��K�K�#�T�*�+�+�+���$�����rc�(�|�||��\}}}tj�tjdtjdd��}tj||��|�||dz��}||dfS)a�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.
    �BUILT_PRODUCTS_DIRr�zembedded.mobileprovisionr��Entitlements)�_FindProvisioningProfiler"r#rLrMr(�copy2�_GetSubstitutions)r�profile�bundle_identifier�source_path�provisioning_data�team_id�target_pathrs        r
rz#MacTool._InstallProvisioningProfile�s���/3�.K�.K��"�/$�/$�+�K�"�G��'�,�,�
�
�'�(�
�
�)�*�"�$�$�K��L��k�*�*�*��*�*�+<�g��m�L�L�M��+�N�;�;�;rc��tj�tjdddd��}tj�|��s2td|ztj���t
jd��d}|rEtj�||d	z��}tj�	|��r|g}|s2tj
tj�|d
����}i}|D]~}|�|��}|�di���dd
��}|�dg��D]&}	|	�d|��}
tj
|
|��r|||	f||<�'�|s2td|ztj���t
jd��t|d����}||S)a/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.
    �HOME�Library�MobileDevicezProvisioning Profilesz&cannot find mobile provisioning for %sr�rNz.mobileprovisionz*.mobileprovisionrzapplication-identifierr�TeamIdentifierr�c� �t|��Sr�r)r	s r
r�z2MacTool._FindProvisioningProfile.<locals>.<lambda>s��#�a�&�&�r�r�)r"r#rLrMr&rTrr�r	r'�glob�_LoadProvisioningProfiler��fnmatch�max)rr#r$�profiles_dir�provisioning_profiles�profile_path�valid_provisioning_profiles�profile_data�app_id_pattern�team_identifier�app_id�selected_keys            r
r z MacTool._FindProvisioningProfile�s��*�7�<�<�
�
�6��I�~�7N�P�P�L�
�7�=�=��&�&���
2�5F�
F��z�����
�h�q�k�k�k� ���/��W�\�\�,��:L�0L�M�M�l�	�����	%�	%�/�!-��� �;�"�i�
�'�,�,�|�%8�
9�
9�;�;��"$��-�;�;���2�2�<�@�@�l�#�'�'�
�"���!�c�":�B�?�?��)�-�-�.>��C�C�;�;�/�+�O�O�->�->�?���?�6�>�2�2�	;��L�/�9;�
%�n�
5��;�
'���
2�5F�
F��z�����
�h�q�k�k�k��2�8H�8H�I�I�I�L�&�|�4�4rc
���tj��5}tjdddd|d|jg��|�|j��cddd��S#1swxYwYdS)z�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.
    �security�cmsz-Dz-ireN)�tempfile�NamedTemporaryFilerQrf�namer)rr7�temps   r
r2z MacTool._LoadProvisioningProfiles���
�	$�	&�	&�3�$���
�e�T�4��t�T�Y�H�I�I�I�
�
'�
'��	�
2�
2�3�3�3�3�3�3�3�3�3�3�3�3����3�3�3�3�3�3s�:A�A�"Ac��|���D]l\}}t|t��rM|�|i��}t|t��r|�||��|||<�a|||<�g|||<�mdS)z"Merge |plist| into |merged_plist|.N)r�r��dictr�r
)rrr�r�r�merged_values      r
r
zMacTool._MergePlists����k�k�m�m�	"�	"�
��U�	�E�4�	 �	 �"�#�'�'��R�0�0���l�D�)�)�	$�
�
�
�<��
/�
/�
/�*�,�s�
�
�#�,�s�
�
�!��S���	"�	"rc�4�	tj|��S#YnxYwtj��5}t	j||j��tjddd|jg��tj|j��cddd��S#1swxYwYdS)a}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.
    rbrc�xml1N)	r�r�rArBr(r!rCrQrf)r�
plist_pathrDs   r
rzMacTool._LoadPlistMaybeBinary"s�����
�
�
+�
+�+���
�d����	�	$�	&�	&�+�$��l�:�t�y�)�)�)���X�z�6�4�9�E�F�F�F�
�
��	�
*�
*�+�+�+�+�+�+�+�+�+�+�+�+����+�+�+�+�+�+s���AB
�
B�Bc��||d�S)aFConstructs 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.
    )�CFBundleIdentifier�AppIdentifierPrefixr�)rr$�app_identifier_prefixs   r
r"zMacTool._GetSubstitutions;s��.�2���rc��tj�tjdtjd��}|�|��}|dS)z�Extracts CFBundleIdentifier value from Info.plist in the bundle.

    Returns:
      Value of CFBundleIdentifier in the Info.plist located in the bundle.
    �TARGET_BUILD_DIR�INFOPLIST_PATHrL)r"r#rLrMr)r�info_plist_path�info_plist_datas   r
rzMacTool._GetCFBundleIdentifierJsP���g�l�l�
�
�%�&�
�
�#�$�&�&�O��0�0��A�A�O��/�0�0rc���|}tj�tjdtjddz��}|s0tj�tjdd��}t	j||��|�|��}|�||��}|r|D]}||vr||||<�tj	||��|S)a[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�PRODUCT_NAMEz.xcent�SDKROOTzEntitlements.plist)
r"r#rLrMr(r!r�_ExpandVariablesr�r)rrrrr%r(�datar�s        r
rzMacTool._InstallEntitlementsVs��� �K��'�,�,�
�
�'�(�
�
�>�"�X�-�/�/�K�� ��G�L�L�
�*�Y�
�
� � �k��L��k�*�*�*��%�%�k�2�2�D�� � ��}�5�5�D��%��%�%�#��d�?�?���n�$�s�)�����k�*�*�*��rc�2����t�t��r5����D]\}}��d|z|�����St�t��r��fd��D��St�t
��r���fd��D��S�S)azExpands 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.
    z$(%s)c�<��g|]}��|�����Sr��rW)�.0r	rrs  ��r
�
<listcomp>z,MacTool._ExpandVariables.<locals>.<listcomp>�s)���
D�
D�
D�!�d�#�#�A�}�5�5�
D�
D�
Drc�J��i|]}|���|����� Sr�r[)r\�krXrrs  ���r
�
<dictcomp>z,MacTool._ExpandVariables.<locals>.<dictcomp>�s/���
M�
M�
M�1�a��&�&�t�A�w�
�>�>�
M�
M�
Mr)r�rr�rrrF)rrXrr�rs```  r
rWzMacTool._ExpandVariablesxs�������$�����%�+�+�-�-�2�2�*�#�u��|�|�G�c�M�5�1�1���
�k��$����E�
D�
D�
D�
D�
D�t�
D�
D�
D�D��$����N�
M�
M�
M�
M�
M�
M��
M�
M�
M�M��KrN) �__name__�
__module__�__qualname__�__doc__rrr4r+r/r,rlr�r�r�r�r�r�r�r�r�r
rrrr r2r
rr"rrrWr�rr
rr"s�������=�=�,�,�,�0�0�0�"�"�"�6/
�/
�/
�bE�E�E����(���&7"�7"�7"�r���.%�%�%�!�!�!�<���"���:������O�O�O�2(�2(�2(�h.�.�.� � � �.<�<�<�.75�75�75�r3�3�3�"�"�"�+�+�+�2
�
�
�
1�
1�
1� � � �D����rrc�0�d|���zS)N�)�
bit_lengthr�s r
�NextGreaterPowerOf2rh�s��	
�Q�N�N���	�rc�X�d}d}d}t|��}t|��}dd|zz}tt|���d����d��}t	|d��}	|	�t
jd	|||||||����d
g|z}
|���D]a\}}d}
|D])}|
t|�	����dzz
}
�*|
|
|dz
z�|
dz}
|
|
|dz
z�||f|
|
|dz
z<�bd}|
D]�}|�+|	�t
jdddd�����/|\}}|}|t|��zdz}|ttj�|��tj
z��zdz}|ttj�|����zdz}|	�t
jd|||������|	�t
jd
����|
D�]v}|��p|\}}|	�t
jdt|��z|����|	�t
jdd����tj�|��tj
z}|	�t
jdt|��z|����|	�t
jdd����tj�|��}|	�t
jdt|��z|����|	�t
jdd������xd
S)aGenerates 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
  ipamhrr��c�,�t|d��S)Nrr/)�ts r
r�zWriteHmap.<locals>.<lambda>�s��S��1��Y�Y�rr0rjz<LHHLLLLN�
z<LLLz<xz<%dsz<s�)rrhr4r�rnrr�struct�pack�ordr%r"r#rH�sepr�)�output_namer��magicr��	_reserved�count�capacity�strings_offset�max_value_lengthr��bucketsr�r#r��c�next_offset�bucket�
key_offset�
prefix_offset�
suffix_offsetrYs                     r
r�r��s���%�
�'��)�

�h�-�-�%�
 ��
'�
'�(���h��'�.���X�^�^�-�-�3F�3F�G�G�G��J�K�K���[�$���#��)�)�F�K�
�E�7�I�~��x�)9�
;�
;�<�<�<��F�X��'��N�N�$�$�/�/�j�d�D�
�C�
�!�!��	�S������^�^�b�
 � �c�c��#��1��$�
%�
1��!�G�c��#��1��$�
%�
1�#'��,�G�C�(�Q�,�����+��	O�	O�f�
�~�	�i�i���F�A�q�!�,�,�-�-�-�-��l�t�T��j� �3�t�9�9�,�q�0�m�#�c�"�'�/�/�$�*?�*?�"�&�*H�&I�&I�I�A�M�m�!�C���(8�(8��(>�(>�$?�$?�?�!�C�k�	�i�i���F�J�
�}�M�M�N�N�N�N��)�)�F�K��������
)�
)�f�
���l�t�T�	�i�i���F�S��Y�Y�.��5�5�6�6�6�	�i�i���D�$�'�'�(�(�(�
�W�_�_�T�
"�
"�R�V�
+�d�	�i�i���F�S��Y�Y�.��5�5�6�6�6�	�i�i���D�$�'�'�(�(�(�
�W�
�
�d�
#�
#�d�	�i�i���F�S��Y�Y�.��5�5�6�6�6�	�i�i���D�$�'�'�(�(�(��
)�
)r�__main__r)rd�
__future__rr�r3r1r�r"r�rOr(rprQrrAr�objectrrhr�rar	�argvr�rr
�<module>r�s4����
&�%�%�%�%�%�����������������	�	�	�	�����	�	�	�	�
�
�
�
�
�
�
�
�����
�
�
�
��������j	�j	�j	�j	�j	�f�j	�j	�j	�X���=)�=)�=)�~�z���
�#�(�4�4���������������r