From 96451a2237133a41477e380c9de58dfad3933677 Mon Sep 17 00:00:00 2001 From: Moritz Bender <35152647+Morilli@users.noreply.github.com> Date: Sat, 26 Oct 2024 18:04:02 +0200 Subject: [PATCH] Fix python `SyntaxWarning`s on non-raw regex strings (#810) --- scripts/extractWSA.py | 2 +- scripts/generateGappsLink.py | 4 ++-- scripts/generateKernelSULink.py | 4 ++-- scripts/generateWSALinks.py | 14 +++++++------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/extractWSA.py b/scripts/extractWSA.py index 386a5aacdd..034d51bc99 100644 --- a/scripts/extractWSA.py +++ b/scripts/extractWSA.py @@ -108,5 +108,5 @@ def __repr__(self): elif g.filename == 'AppxManifest.xml': g.filename = f'resources.{name}.xml' l.extract(g, xmldir) - elif re.search(u'Images/.+\.png', g.filename): + elif re.search(r'Images/.+\.png', g.filename): l.extract(g, archdir) diff --git a/scripts/generateGappsLink.py b/scripts/generateGappsLink.py index addaa362a5..ecb77798d2 100644 --- a/scripts/generateGappsLink.py +++ b/scripts/generateGappsLink.py @@ -59,9 +59,9 @@ def __call__(self, r): download_files = {} assets = json_data["assets"] for asset in assets: - if re.match(f'gapps.*{release}.*\.rc$', asset["name"]): + if re.match(rf'gapps.*{release}.*\.rc$', asset["name"]): download_files[asset["name"]] = asset["browser_download_url"] - elif re.match(f'gapps.*{release}.*{abi_map[arch]}.*\.img$', asset["name"]): + elif re.match(rf'gapps.*{release}.*{abi_map[arch]}.*\.img$', asset["name"]): download_files[asset["name"]] = asset["browser_download_url"] with open(download_dir/tempScript, 'a') as f: for key, value in download_files.items(): diff --git a/scripts/generateKernelSULink.py b/scripts/generateKernelSULink.py index 2650d7f1da..5588ea71fd 100644 --- a/scripts/generateKernelSULink.py +++ b/scripts/generateKernelSULink.py @@ -67,7 +67,7 @@ def __repr__(self): assets = json_data["assets"] for asset in assets: asset_name = asset["name"] - if re.match(f'kernel-WSA-{abi_map[arch]}-{kernelVersion}.*\.zip$', asset_name) and asset["content_type"] == "application/zip": + if re.match(rf'kernel-WSA-{abi_map[arch]}-{kernelVersion}.*\.zip$', asset_name) and asset["content_type"] == "application/zip": tmp_kernel_ver = re.search( u'\d{1}.\d{1,}.\d{1,}.\d{1,}', asset_name.split("-")[3]).group() if (kernel_ver == 0): @@ -76,7 +76,7 @@ def __repr__(self): kernel_ver = tmp_kernel_ver print(f"Kernel version: {kernel_ver}", flush=True) for asset in assets: - if re.match(f'kernel-WSA-{abi_map[arch]}-{kernel_ver}.*\.zip$', asset["name"]) and asset["content_type"] == "application/zip": + if re.match(rf'kernel-WSA-{abi_map[arch]}-{kernel_ver}.*\.zip$', asset["name"]) and asset["content_type"] == "application/zip": link = asset["browser_download_url"] break if link == "": diff --git a/scripts/generateWSALinks.py b/scripts/generateWSALinks.py index 66db1bc44d..81781ef585 100644 --- a/scripts/generateWSALinks.py +++ b/scripts/generateWSALinks.py @@ -145,26 +145,26 @@ def send_req(i, v, out_file_name): threads = [] wsa_build_ver = 0 for filename, values in identities.items(): - if re.match(f"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename): + if re.match(rf"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename): tmp_wsa_build_ver = re.search( - u'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group() + r'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group() if (wsa_build_ver == 0): wsa_build_ver = tmp_wsa_build_ver elif version.parse(wsa_build_ver) < version.parse(tmp_wsa_build_ver): wsa_build_ver = tmp_wsa_build_ver for filename, values in identities.items(): - if re.match(f"Microsoft\.UI\.Xaml\..*_{arch}_.*\.appx", filename): + if re.match(rf"Microsoft\.UI\.Xaml\..*_{arch}_.*\.appx", filename): out_file_name = f"{values[1]}_{arch}.appx" out_file = download_dir / out_file_name - elif re.match(f"Microsoft\.VCLibs\..+\.UWPDesktop_.*_{arch}_.*\.appx", filename): + elif re.match(rf"Microsoft\.VCLibs\..+\.UWPDesktop_.*_{arch}_.*\.appx", filename): out_file_name = f"{values[1]}_{arch}.appx" out_file = download_dir / out_file_name - elif re.match(f"Microsoft\.VCLibs\..+_.*_{arch}_.*\.appx", filename): + elif re.match(rf"Microsoft\.VCLibs\..+_.*_{arch}_.*\.appx", filename): out_file_name = f"{values[1]}_{arch}.appx" out_file = download_dir / out_file_name - elif not skip_wsa_download and re.match(f"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename): + elif not skip_wsa_download and re.match(rf"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename): tmp_wsa_build_ver = re.search( - u'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group() + r'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group() if (wsa_build_ver != tmp_wsa_build_ver): continue version_splitted = wsa_build_ver.split(".")