win: ap: add cache to driver identification routine

This commit is contained in:
Vladislav Yarmak 2019-10-23 20:00:32 +03:00
parent c38b472336
commit a36d883800

View File

@ -8,6 +8,7 @@ import os.path
from binascii import unhexlify from binascii import unhexlify
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
import itertools import itertools
import functools
CRLF = b"\x0d\x0a" CRLF = b"\x0d\x0a"
@ -170,6 +171,7 @@ def make_patch(archive, *,
return res return res
@functools.lru_cache(maxsize=None)
def identify_driver(archive, *, sevenzip="7z"): def identify_driver(archive, *, sevenzip="7z"):
manifest = extract_single_file(archive, "setup.cfg", sevenzip=sevenzip) manifest = extract_single_file(archive, "setup.cfg", sevenzip=sevenzip)
root = ET.fromstring(manifest) root = ET.fromstring(manifest)