ó  îRac@sÖddlZddlZddlZddlmZded„Zdd„Zdeed„Zidd 6d d 6d d 6dd6dd6dd6dd6Z ej ddj e ej e jƒƒƒƒZed„ZdS(iÿÿÿÿN(treducesutf-8cCs@d|g}|r#|jdƒnt|||ƒdj|ƒS(sy Writes the XML content to disk, touching the file only if it has changed. Visual Studio files have a lot of pre-defined structures. This function makes it easy to represent these structures as Python data structures, instead of having to create a lot of function calls. Each XML element of the content is represented as a list composed of: 1. The name of the element, a string, 2. The attributes of the element, a dictionary (optional), and 3+. The content of the element, if any. Strings are simple text nodes and lists are child elements. Example 1: becomes ['test'] Example 2: This is it! becomes ['myelement', {'a':'value1', 'b':'value2'}, ['childtype', 'This is'], ['childtype', 'it!'], ] Args: content: The structured content to be converted. encoding: The encoding to report on the first XML line. pretty: True if we want pretty printing with indents and new lines. Returns: The XML content as a string. s#s t(tappendt_ConstructContentListtjoin(tcontenttencodingtprettyt xml_parts((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/easy_xml.pyt XmlToString s ' ic CsÉ|rd|}d}n d}d}|d}t|tƒsWtdt|ƒƒ‚n|j|d|ƒ|d}|ræt|dtƒræxGt|djƒƒD]/\}} |jd|t| d tƒfƒq¦W|d}n|r´|jd ƒt d „|tƒ} | } | r1|r1|j|ƒnxJ|D]B} t| tƒrc|jt| ƒƒq8t || ||dƒq8W| rš|rš|j|ƒn|jd ||fƒn|jd |ƒdS(s+ Appends the XML parts corresponding to the specification. Args: xml_parts: A list of XML parts to be appended to. specification: The specification of the element. See EasyXml docs. pretty: True if we want pretty printing with indents and new lines. level: Indentation level. s s RisRThe first item of an EasyXml specification should be a string. Specification was tcSs|ot|tƒS(N(t isinstancetstr(txty((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/easy_xml.pytYRs%ss/>%sN( R Rt ExceptionRtdicttsortedtitemst _XmlEscapetTrueRR( Rt specificationRtlevelt indentationtnew_linetnametresttattvalt all_stringst multi_linet child_spec((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/easy_xml.pyR;s:     #'     c Csèt|||ƒ}|r<tjdkr<|jddƒ}ntjƒd}|jƒ|jƒkrv|j|ƒ}ny)t|dƒ}|j ƒ}|j ƒWn d}nX||krät|dƒ}|j |ƒ|j ƒndS(s: Writes the XML content to disk, touching the file only if it has changed. Args: content: The structured content to be written. path: Location of the file. encoding: The encoding to report on the first line of the XML file. pretty: True if we want pretty printing with indents and new lines. s s itrtwbN( R tostlineseptreplacetlocaletgetdefaultlocaletuppertencodetopentreadtclosetNonetwrite( RtpathRRtwin32t xml_stringtdefault_encodingtftexisting((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/easy_xml.pytWriteXmlIfChangedks     s"t"s't's<R s>R s&t&s s s s s(%s)t|cs‡fd†}tj||ƒS(s& Escape a string for inclusion in XML.cs:|j|jƒ|jƒ!}ˆr2|dkr2|St|S(NR9(tstringtstarttendt_xml_escape_map(tmatchtm(R (sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/easy_xml.pyR's(t_xml_escape_retsub(tvalueR R'((R sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/easy_xml.pyR›s(treR%R(t functoolsRtFalseR RR7R?tcompileRtmaptescapetkeysRBR(((sj/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/easy_xml.pyts$   0 0  (