Ë
/†Z1Íœã
ó
— d dl Z d dlZd dlZd dlZ e dd„Zdd„Z dd„Z dddd d
ddd
œZ
e j ddj e
e j e
j « « « z « Zdd„Zy# e$ r d dlmZ Y Œmw xY w)é N)Úreducec óp — d|z g}|r|j d« t || |« dj |« S )ay 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.
z#Ú
Ú )ÚappendÚ_ConstructContentListÚjoin)ÚcontentÚencodingÚprettyÚ xml_partss ú1/usr/lib/python3.12/site-packages/gyp/easy_xml.pyÚXmlToStringr s@ € ðN 5°xÑ?Ð@€)ÙØ
×Ñ�TÔܘ 7¨FÔ3ð
�‰�Ó Ðó c
óì — |rd|z }d}nd}d}|d }t |t « st dt |« z « ‚| j |dz |z « |dd }|r_t |d t « rLt |d j
« « D ]( \ }} | j d |›d
t | d¬« ›d
�« Œ* |dd }|r§| j d« t d„ |d« }
|
}|r|r| j |« |D ]> }t |t « r| j t |« « Œ.t | |||dz « Œ@ |r|r| j |« | j d|›d|›�« y| j d|z « y)a+ 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.
z r r r zRThe first item of an EasyXml specification should be a string. Specification was Ú<é NÚ z="T)ÚattrÚ"Ú>c ó* — | xr t |t « S )N)Ú
isinstanceÚstr)ÚxÚys r Úz'_ConstructContentList..^ s € aÒ&>¬J°q¼#Ó,>Ð&>r z%s)
r r Ú Exceptionr ÚdictÚsortedÚitemsÚ
_XmlEscaper r )
r
Ú
specificationr ÚlevelÚindentationÚnew_lineÚnameÚrestÚatÚvalÚall_stringsÚ
multi_lineÚ
child_specs
r r r @ s} € ñ ؘ‘,€KØ�Hà€KØ€HØ �qÑ €$Ü �Dœ#Ô Ü
ð 4Ü69¸-Ó6HñIó Jð Jà×Ñ�; Ñ$ tÑ+Ô,ð
�q�rÐ €$Ù Œj˜˜a™¤$Ô'ܘ$˜q™'Ÿ-™-›/Ö*‰ˆˆCØ×Ò¢R¬°C¸dÖ)CÐDÕEð +à��ˆ8€DÙ Ø
×Ñ�SÔÜÑ>ÀÀdÓK€KØ �€JÙ‘hØ×Ñ�xÔ Ûˆ
ô
�J¤Ô $Ø×Ñœ
:Ó.Õ/ä˜i¨°V¸UÀQ¹YÕGð
ñ ‘kØ×Ñ�{Ô#Ø
×Ò¢$©Ð1Õ2à
×Ñ�V˜hÑ&Õ'r c ó — t | ||« }|r€t j dk7 rm|j dd« }t j
« d }|rB|j
« |j
« k7 r! |j |« j |« } t |d« }|j « }|j « ||k7 r.t |d« }|j |« |j « yy# t $ r Y Œlw xY w# d}Y ŒIxY w)a: 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.
z
r r ÚrNÚw)r ÚosÚlinesepÚreplaceÚlocaleÚgetdefaultlocaleÚupperÚdecodeÚencodeÚAttributeErrorÚopenÚreadÚcloseÚwrite) r
Úpathr r Úwin32Ú
xml_stringÚdefault_encodingÚfÚexistings r ÚWriteXmlIfChangedrD p sô € ô ˜7 H¨fÓ5€*Ù
Œr�z‰z˜VÒ#Ø×#Ñ# D¨&Ó1€JÜ×.Ñ.Ó0°Ñ3ÐÙÐ,×2Ñ2Ó4¸¿¹Ó8HÒHð
Ø×&Ñ&Ð'7Ó8×?Ñ?ÀÓIˆ
ð
܈T�3‹€AØ�v‰v‹x€H؇G�G„Ið
�Ò܈T�3‹€A؇G�GˆJÔØ‡G�G…Ið øô ò
Ùð
ûðØ‚Hús Á0 C1 Â,D Ã1 C=Ã<C=Ä Dz"z'z<z>z&z
z
)r Ú'r r Ú&r Ú
z(%s)Ú|c ó: ‡— ˆfd„}t j || « S )z& Escape a string for inclusion in XML.c ó~ •— | j | j « | j « }‰r|dk( r|S t | S )NrE )ÚstringÚstartÚendÚ_xml_escape_map)ÚmatchÚmr s €r r3 z_XmlEscape..replace¤ s8 ø€ Ø
�‰�U—[‘[“] U§Y¡Y£[Ð1€Aá��S’Ø
€hܘ1ÑÐr )Ú_xml_escape_reÚsub)Úvaluer r3 s ` r r" r" ¢ s ø€ ôô
× Ñ ˜G UÓ +Ð+r )úutf-8F)r )rT FF)F)Úrer1 r4 Úsysr Ú NameErrorÚ functoolsr r rD rN Úcompiler ÚmapÚescapeÚkeysrQ r" © r r Úr^ s¥ ðó
Û Û
Û
ðáó-ó`-(ð` ?DØ!ó ðH
Ø Ø Ø Ø Ø
Ø
ñ€ð �—‘Ø
ˆS�X‰X‘c˜"Ÿ)™) _×%9Ñ%9Ó%;Ó<Ó
=Ñ=ó?€ô,øðk ò ßðús ’A4 Á4BÂB