From 834b6e35b450a471e26f0e5a4c5c367faf760f7a Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Thu, 18 Jan 2024 01:52:33 +0100 Subject: [PATCH] Setup: auto update vc redist (#2502) --- inno_setup.iss | 2 +- setup.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/inno_setup.iss b/inno_setup.iss index be5de320..b122cdc0 100644 --- a/inno_setup.iss +++ b/inno_setup.iss @@ -197,7 +197,7 @@ begin begin // Is the installed version at least the packaged one ? Log('VC Redist x64 Version : found ' + strVersion); - Result := (CompareStr(strVersion, 'v14.32.31332') < 0); + Result := (CompareStr(strVersion, 'v14.38.33130') < 0); end else begin diff --git a/setup.py b/setup.py index 05e923ed..9b28715a 100644 --- a/setup.py +++ b/setup.py @@ -349,6 +349,18 @@ class BuildExeCommand(cx_Freeze.command.build_exe.BuildEXE): for folder in sdl2.dep_bins + glew.dep_bins: shutil.copytree(folder, self.libfolder, dirs_exist_ok=True) print(f"copying {folder} -> {self.libfolder}") + # windows needs Visual Studio C++ Redistributable + # Installer works for x64 and arm64 + print("Downloading VC Redist") + import certifi + import ssl + context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH, cafile=certifi.where()) + with urllib.request.urlopen(r"https://aka.ms/vs/17/release/vc_redist.x64.exe", + context=context) as download: + vc_redist = download.read() + print(f"Download complete, {len(vc_redist) / 1024 / 1024:.2f} MBytes downloaded.", ) + with open("VC_redist.x64.exe", "wb") as vc_file: + vc_file.write(vc_redist) for data in self.extra_data: self.installfile(Path(data))