�
K��b�� � �N � d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl Z
ddlZ
ddlmZ e
n
# e$ r eZ
Y nw xY w ej d� � Zd� Zd� Zd � Zd
� Zd� Zd� Zd
� Zd� Zd� Z G d� de� � Zd� Z G d� de� � Zdad� Z d� Z!d� Z"d� Z#d� Z$d� Z%d� Z&d� Z'd� Z(dS )zg
This module helps emulate Visual Studio 2008 behavior on top of other
build systems, primarily ninja.
� N)�collections_abc)�
OrderedSet)�version_to_tuplez(\\*)"c �@ � t j d� � sQ| � d� � dk s| � d� � dk rt j � | � � } t � d� | � � } | � dd� � } d| z dz S ) z�Quote a command line argument so that it appears as one argument when
processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for
Windows programs).�#GYP_MSVS_DISABLE_PATH_NORMALIZATION�/r � c �8 � d| � d� � z dz S )N� r �\")�group)�mos �4/usr/lib/python3/dist-packages/gyp/msvs_emulation.py�<lambda>z!QuoteForRspFile.<locals>.<lambda>2 s � �A�������O�e�,C� � �%z%%�") �os�getenv�find�count�path�normpath�windows_quoter_regex�sub�replace)�args r �QuoteForRspFiler s� � �
��8� 9� 9� "�
�x�x��}�}�q���C�I�I�c�N�N�Q�.�.��G���S�!�!�c�
� � �!C�!C�S�I�I�#� ���C����#�
�s��S��r c �n � | sdS | d � d� � rE| d � dd� � \ }}|dz t j � |� � z }n%t j � | d � � }|dz d� d� | dd� D � � � � z S )z6Process a list of arguments using QuoteCmdExeArgument.� r zcall � r c 3 �4 K � | ]}t |� � V � �d S �N)r )�.0r s r � <genexpr>z$EncodeRspFileList.<locals>.<genexpr>P s* � � � �!K�!K�3�/�#�"6�"6�!K�!K�!K�!K�!K�!Kr N)�
startswith�splitr r r �join)�args�call�programs r �EncodeRspFileListr, C s� � �
��b�b� �!�W���� � � (���G�M�M�#�q�)�)�M�D�'��S�j�2�7�+�+�G�4�4�4�G�G��g���t�A�w�'�'�G� �3�����!K�!K�$�q�r�r�(�!K�!K�!K�K�K� K�Kr c �v � | s|S |s| S t | � |d � � ||dd� � � S )z�Given a list of dictionary keys |path| and a tree of dicts |root|, find
value at path, or return |default| if any of the path doesn't exist.r r N)�_GenericRetrieve�get)�root�defaultr s r r. r. S sH � �
� ��N�
� ��K� �$�(�(�4��7�+�+�W�d�1�2�2�h� ?� ?�?r c � �� | �| S t | t j � � r#t | t � � s�fd�| D � � S �| z S )zDAdd |prefix| to |element| or each subelement if element is iterable.Nc � �� g | ]}�|z ��S � r4 )r$ �e�prefixs �r �
<listcomp>z_AddPrefix.<locals>.<listcomp>c s �� �(�(�(�1�F�Q�J�(�(�(r )�
isinstancer �Iterable�
basestring)�elementr6 s `r �
_AddPrefixr< |