From 8106e01604732a0c9b3d85cdc743882bfa75a8a3 Mon Sep 17 00:00:00 2001 From: Aditya Garg Date: Fri, 31 May 2024 16:45:24 +0530 Subject: [PATCH] Use os.path.relpath instead of lstrip Using lstrip sometimes broken the folder names in wifi folder by removing the "C" in the relpath. A code similar to the following was added to debug: if props: log.error(f"Unhandled properties found: {props} in file {relpath}") assert not props and the result was: Unhandled properties found: {'': '4355'} in file -4355__s-C1/P-hawaii-ID_M-YSBC_V-m__m-2.3.txt Traceback (most recent call last): File "/home/aditya/firmware.sh", line 905, in wifi_col = WiFiFWCollection(sys.argv[1]+"/wifi") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/aditya/firmware.sh", line 737, in __init__ self.load(source_path) File "/home/aditya/firmware.sh", line 776, in load assert not props AssertionError Signed-off-by: Aditya Garg --- asahi_firmware/wifi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asahi_firmware/wifi.py b/asahi_firmware/wifi.py index 346965c..704da59 100644 --- a/asahi_firmware/wifi.py +++ b/asahi_firmware/wifi.py @@ -45,7 +45,7 @@ def load(self, source_path): dirnames.remove("perf") if "assert" in dirnames: dirnames.remove("assert") - subpath = dirpath.lstrip(source_path) + subpath = os.path.relpath(dirpath, source_path) for name in sorted(filenames): if not any(name.endswith("." + i) for i in self.EXTMAP): continue