Skip to content

fix(get.py): Check if win32 tools also exist when running on win64 #10565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(get.py): Check if win32 tools also exist when running on win64
  • Loading branch information
lucasssvaz committed Nov 4, 2024
commit b8148b8c4a30ec22d805162e9fdaa9ca946144f7
12 changes: 12 additions & 0 deletions tools/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,10 @@ def load_tools_list(filename, platform):
tools_info = json.load(open(filename))["packages"][0]["tools"]
tools_to_download = []
for t in tools_info:
if platform == "x86_64-mingw32":
if "i686-mingw32" not in [p["host"] for p in t["systems"]]:
raise Exception("Windows x64 requires both i686-mingw32 and x86_64-mingw32 tools")

tool_platform = [p for p in t["systems"] if p["host"] == platform]
if len(tool_platform) == 0:
# Fallback to x86 on Apple ARM
Expand All @@ -382,6 +386,8 @@ def load_tools_list(filename, platform):
if len(tool_platform) == 0:
continue
else:
if verbose:
print(f"Tool {t['name']} is not available for platform {platform}")
continue
tools_to_download.append(tool_platform[0])
return tools_to_download
Expand Down Expand Up @@ -433,6 +439,12 @@ def identify_platform():
force_all = args.force_all
is_test = args.test

# Set current directory to the script location
if getattr(sys, "frozen", False):
os.chdir(os.path.dirname(sys.executable))
else:
os.chdir(os.path.dirname(os.path.abspath(__file__)))

if is_test and (force_download or force_extract or force_all):
print("Cannot combine test (-t) and forced execution (-d | -e | -f)")
parser.print_help(sys.stderr)
Expand Down
Loading