HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //proc/self/root/lib/python3.6/site-packages/gyp/__pycache__/xcode_ninja.cpython-36.opt-1.pyc
3

��S](,�@sPdZddlZddlZddlZddlZddlZdd�Zdd�Z	dd�Z
d	d
�ZdS)a�Xcode-ninja wrapper project file generator.

This updates the data structures passed to the Xcode gyp generator to build
with ninja instead. The Xcode project itself is transformed into a list of
executable targets, each with a build step to build with ninja, and a target
with every source and resource file.  This appears to sidestep some of the
major performance headaches experienced using complex projects and large number
of targets within Xcode.
�Nc$CsHtjj|�\}}|d}|d}|jr6tjj|j|�}ytj|�Wn0tk
rt}z|jtjkrd�WYdd}~XnXd}xJ||gD]>}	tjjtjj	|	��dd}
t
jjj
d|
�}
|d	|
7}q�W|d
7}tjj|d�}y0t|d��}|j�}
|
|k�rdSWdQRXWntk
�r"YnXt|d
��}|j|�WdQRXdS)z8 Create a workspace to wrap main and sources gyp paths. z.xcworkspace�optionsNz'<?xml version="1.0" encoding="UTF-8"?>
z<Workspace version = "1.0">
rz
.xcodeprojzgroup:z$  <FileRef location = %s></FileRef>
z
</Workspace>
zcontents.xcworkspacedata�r�wzC<?xml version="1.0" encoding="UTF-8"?>
<Workspace version = "1.0">
)�os�path�splitextZgenerator_output�join�makedirs�OSError�errnoZEEXIST�basename�xmlZsaxZsaxutilsZ	quoteattr�open�read�IOError�write)�main_gyp�sources_gyp�params�build_file_root�build_file_extZworkspace_pathr�eZ
output_string�gyp_name�nameZworkspace_fileZ
input_fileZinput_stringZoutput_file�r�!/usr/lib/python3.6/xcode_ninja.py�_WriteWorkspaces6
rc
	Csd}d}|rB|d}tjj|jtjjj|��}|jdi�jdd�}|jd�}|jd|�}|jd�}i}||d<||d<|r�||d<|jd	�|d	<|jd
�|d
<i|d<i}	|r�d||	d
<d|k�rNx�|dj	�D]x}
|d|
jdi�}d|k�rd|	d<|d|	d<x$d$D]}||k�r|||	|<�qWi|d|
<|	|d|
d<q�W|jdd�|d<|jdd�|d<|jdd�|d<|jdd�|d<|jdd�|d<|d|d<|�rd|ggddtj
ddd|	d
|gd|d �g|d!<|dk�r|d!dd"jd#|f�|S)%z- Create fake target for xcode-ninja wrapper. Nrr�generator_flagsZxcode_ninja_jobs�target_name�product_name�product_extension�toolset�default_configuration�configurationsz-%s/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)ZCONFIGURATION_BUILD_DIR�xcode_settingsZIPHONEOS_DEPLOYMENT_TARGETZNOZCODE_SIGNING_REQUIRED�
BUNDLE_LOADER�	TEST_HOST�
mac_bundle�mac_xctest_bundleZios_app_extensionZios_watchkit_extensionZios_watchkit_app�typezCompile and copy %s via ninja�envzPATH=%s�PATH�ninjaz-C)Zaction_name�inputsZoutputs�action�message�actionsr.z-j)r%r&)rrrZtoplevel_dir�gyp�	generatorr,ZComputeOutputDir�get�keys�environ�extend)
Zold_specrZninja_toplevelZjobsrrrr Zninja_targetZnew_xcode_settings�configZold_xcode_settings�keyrrr�_TargetFromSpec8sh







r9cCsv|jd�}|dk	r"tj||�r"dSt|jdd��dksV|jdd�dkrr|jd	d�d
krr|dk	rntj||�sndSdSdS)apLimit targets for Xcode wrapper.

  Xcode sometimes performs poorly with too many targets, so only include
  proper executable targets, with filters to customize.
  Arguments:
    target_extras: Regular expression to always add, matching any target.
    executable_target_pattern: Regular expression limiting executable targets.
    spec: Specifications for target.
  rNTr(rr)��
executabler ZbundleF)r3�re�search�int)�
target_extras�executable_target_pattern�specrrrr�IsValidTargetForWrapper�s

rBc!sR|dd}x$|j�D]\}}||kr|d}qW|jdi�}|jdd�}	|	dkrntjj|�\}
}|
d|}	g}i}
i}i||	<g||	d<g||	d	<||jd
i�||	d
<|jdd�}|jdd�}x�|D]�}||}t|||�r�|jd
�}d|	|f}|j|�t||�|
|<x\||jd�dd	D]B}|d
|k�r.i}|d
|d
<|d|d<||	d	j|��q.Wq�Wd}t|ddddd�d�}dd|gii|d<|jdd�}g}x�|j�D]�\}}tjj	|��|jdg�|jdg�}|�s|j
|jdg�|jdg��x@|jdg�D]0}|j
|jd g��|�s|j
|jd!g���qWd"d#�|D�}tjj	|	��|��fd$d#�|D�7}�q�Wtt|��|d<tjj
tjj	|	�|d%�}d||f} |j| �||
| <i}|d
|d
<||d<d|d<i||<g||d	<g||d<||jd
i�||d
<||d	j|�t|	||�||
|fS)&a�Initialize targets for the ninja wrapper.

  This sets up the necessary variables in the targets to generate Xcode projects
  that use ninja as an external builder.
  Arguments:
    target_list: List of target pairs: 'base/base.gyp:base'.
    target_dicts: Dict of target properties keyed on target pair.
    data: Dict of flattened build files keyed on gyp path.
    params: Dict of global options for gyp.
  Zbuild_filesrZ_DEPTHrZxcode_ninja_main_gypNz.ninjaZincluded_filesZtargetsr$Z%xcode_ninja_executable_target_patternZxcode_ninja_target_patternrz%s:%s#target�:r!Zsources_for_indexing�targetZDefault�0r;)rr!r"r'r)Zinclude_dirsr#Zxcode_ninja_list_excluded_filesT�sourcesZmac_bundle_resourcesZsources_excludedZmac_bundle_resources_excludedr0r-Zinputs_excludedcSsg|]}|jd�s|�qS)�$)�
startswith)�.0�filerrr�
<listcomp>sz!CreateWrapper.<locals>.<listcomp>cs$g|]}tjjtjj�|����qSr)rr�relpathr)rIrJ)�base�
relative_pathrrrKsz.gyp)�itemsr3rrrrB�appendr9�split�dirnamer6�sorted�setrr)!Ztarget_listZtarget_dicts�datarZorig_gyprZgyp_dict�depthrrrrZnew_target_listZnew_target_dictsZnew_datar@r?Zold_qualified_targetrArZnew_target_nameZ
old_targetZnew_data_targetZsources_target_nameZsources_targetZskip_excluded_filesrFrD�target_dict�filesr.rZfully_qualified_target_namer)rMrNr�
CreateWrapper�s�




rY)�__doc__rZgyp.generator.ninjar1rr<Zxml.sax.saxutilsr
rr9rBrYrrrr�<module>
s"K