From 9b5c28b29c00c7ba35b845f5cce21938caec86f9 Mon Sep 17 00:00:00 2001 From: Jai Luthra Date: Thu, 26 Oct 2023 15:39:42 +0530 Subject: [PATCH] autopatch: fix indent for local installer case Signed-off-by: Jai Luthra --- win/tools/autopatch/autopatch.py | 76 ++++++++++++++++---------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/win/tools/autopatch/autopatch.py b/win/tools/autopatch/autopatch.py index b616004..fb44aee 100755 --- a/win/tools/autopatch/autopatch.py +++ b/win/tools/autopatch/autopatch.py @@ -238,47 +238,47 @@ def patch_flow(installer_file, search, replacement, target, target_name, patch_n print(f"Invalid installer file or version: {installer_file}") return - # Rest of the code remains the same... - patch = make_patch(installer_file, - arch_tgt=target, - search=search, - replacement=replacement, - tmpdir=tempdir, - sevenzip=sevenzip, - direct=direct) - patch_content = format_patch(patch, target_name) + # Rest of the code remains the same... + patch = make_patch(installer_file, + arch_tgt=target, + search=search, + replacement=replacement, + tmpdir=tempdir, + sevenzip=sevenzip, + direct=direct) + patch_content = format_patch(patch, target_name) - if stdout: - sys.stdout.buffer.write(patch_content) - elif direct: - with open(patch_name, mode='wb') as out: - out.write(patch_content) + if stdout: + sys.stdout.buffer.write(patch_content) + elif direct: + with open(patch_name, mode='wb') as out: + out.write(patch_content) + else: + version, product_type = identify_driver(installer_file, sevenzip=sevenzip) + drv_prefix = { + "100": "quadro_", + "103": "quadro_", + "300": "", + "301": "nsd_", + "303": "", # DCH + "304": "nsd_", + } + installer_name = os.path.basename(installer_file).lower() + if 'winserv2008' in installer_name or 'winserv-2012' in installer_name: + os_prefix = 'ws2012_x64' + elif 'winserv-2016' in installer_name or 'win10' in installer_name: + os_prefix = 'win10_x64' + elif 'win7' in installer_name: + os_prefix = 'win7_x64' else: - version, product_type = identify_driver(installer_file, sevenzip=sevenzip) - drv_prefix = { - "100": "quadro_", - "103": "quadro_", - "300": "", - "301": "nsd_", - "303": "", # DCH - "304": "nsd_", - } - installer_name = os.path.basename(installer_file).lower() - if 'winserv2008' in installer_name or 'winserv-2012' in installer_name: - os_prefix = 'ws2012_x64' - elif 'winserv-2016' in installer_name or 'win10' in installer_name: - os_prefix = 'win10_x64' - elif 'win7' in installer_name: - os_prefix = 'win7_x64' - else: - raise UnknownPlatformException(f"Can't infer platform from filename {installer_name}") + raise UnknownPlatformException(f"Can't infer platform from filename {installer_name}") - driver_name = drv_prefix.get(product_type, "") + version - out_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', os_prefix, driver_name) - os.makedirs(out_dir, 0o755, exist_ok=True) - out_filename = os.path.join(out_dir, patch_name) - with open(out_filename, 'wb') as out: - out.write(patch_content) + driver_name = drv_prefix.get(product_type, "") + version + out_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', os_prefix, driver_name) + os.makedirs(out_dir, 0o755, exist_ok=True) + out_filename = os.path.join(out_dir, patch_name) + with open(out_filename, 'wb') as out: + out.write(patch_content) def main():