File: //usr/lib/python3.6/site-packages/gyp/__pycache__/msvs_emulation.cpython-36.pyc
3
��S]�� � @ s4 d Z ddlZddlZddlZddlZddlZddlmZ ddlZ ddl
Z ye W n ek
rh e
ZY nX ejd�Zdd� Zdd� Zd d
� Zdd� Zd
d� Zdd� Zdd� Zdd� Zdd� ZG dd� de�Zdd� ZG dd� de�Zdadd� Zdd � Zd!d"� Z d#d$� Z!d%d&� Z"d'd(� Z#d)d*� Z$d+d,� Z%d-d.� Z&dS )/zg
This module helps emulate Visual Studio 2008 behavior on top of other
build systems, primarily ninja.
� N)�
OrderedSetz(\\*)"c C sP | j d�dks| jd�dkr(tjj| �} tjdd� | �} | jdd�} d| d 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).�/r � c S s d| j d� d S )N� r z\")�group)�mo� r �$/usr/lib/python3.6/msvs_emulation.py�<lambda>/ s z!QuoteForRspFile.<locals>.<lambda>�%z%%�")�find�count�os�path�normpath�windows_quoter_regex�sub�replace)�argr r r �QuoteForRspFile s
r c C st | sdS | d j d�r@| d jdd�\}}|d tjj|� }ntjj| d �}|d djdd� | dd� D �� S ) z6Process a list of arguments using QuoteCmdExeArgument.� r zcall � r c s s | ]}t |�V qd S )N)r )�.0r r r r � <genexpr>M s z$EncodeRspFileList.<locals>.<genexpr>N)�
startswith�splitr r r �join)�argsZcallZprogramr r r �EncodeRspFileList@ s r c C s. | s|S |s| S t | j|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 r r r r P s
r c sB | dkr| S t | tj�r6t | t� r6� fdd�| D �S � | S dS )zDAdd |prefix| to |element| or each subelement if element is iterable.Nc s g | ]}� | �qS r r )r �e)�prefixr r �
<listcomp>` s z_AddPrefix.<locals>.<listcomp>)�
isinstance�collections�Iterable�
basestring)�elementr% r )r% r �
_AddPrefixZ s r, c s\ � dk rX| dk rXt � �s� j� t| tj�rPt| t� rPtd� fdd�| D ��} n� | �} | S )z�If |element| then remap it through |map|. If |element| is iterable then
each item will be remapped. Any elements not found will be removed.Nc s g | ]}� |��qS r r )r �elem)�mapr r r&