MCPcopy Create free account
hub / github.com/python/cpython / _fixup_sccd

Function _fixup_sccd

PC/layout/support/appxmanifest.py:219–244  ·  view source on GitHub ↗
(ns, sccd, new_hash=None)

Source from the content-addressed store, hash-verified

217
218
219def _fixup_sccd(ns, sccd, new_hash=None):
220 if not new_hash:
221 return sccd
222
223 NS = dict(s="http://schemas.microsoft.com/appx/2016/sccd")
224 with open(sccd, "rb") as f:
225 xml = ET.parse(f)
226
227 pfn = get_packagefamilyname(APPX_DATA["Name"], APPX_DATA["Publisher"])
228
229 ae = xml.find("s:AuthorizedEntities", NS)
230 ae.clear()
231
232 e = ET.SubElement(ae, ET.QName(NS["s"], "AuthorizedEntity"))
233 e.set("AppPackageFamilyName", pfn)
234 e.set("CertificateSignatureHash", new_hash)
235
236 for e in xml.findall("s:Catalog", NS):
237 e.text = "FFFF"
238
239 sccd = ns.temp / sccd.name
240 sccd.parent.mkdir(parents=True, exist_ok=True)
241 with open(sccd, "wb") as f:
242 xml.write(f, encoding="utf-8")
243
244 return sccd
245
246
247def find_or_add(xml, element, attr=None, always_add=False):

Callers 1

get_appx_layoutFunction · 0.85

Calls 9

get_packagefamilynameFunction · 0.85
openFunction · 0.50
parseMethod · 0.45
findMethod · 0.45
clearMethod · 0.45
setMethod · 0.45
findallMethod · 0.45
mkdirMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…