-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
SCons: Implement get_mingw_tool
to fix mingw prefix ambiguity (reverted)
#85319
Conversation
By the way I’d like you to add the example of
godot/platform/windows/detect.py Lines 324 to 328 in 1ba920f
Footnotes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me overall. Haven't tested yet.
cca85db
to
59d32eb
Compare
• Replaces "try_cmd" entirely and removes need for "get_mingw_bin_prefix" in isolation
59d32eb
to
ecebe0b
Compare
Thanks! |
After this fix, I can't build Godot on windows... Am I missing something in MinGW? It was buildable until one of the commits prior to this PR, so does this PR cause it to check and block anything?
|
This probably should be reverted since it's based on wrong assumption about prefixes (it's checking for empty arch, but always adding path part of the prefix), a lot of tool chains have some prefixed (compilers, etc.) and some non-prefixed tools (generic stuff like windres), and have them in the different locations. |
Or I guess an extra case can be added to the diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index ccf889f1a3..22b2d90fdb 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -40,6 +40,19 @@ def get_mingw_tool(tool, prefix="", arch="", test="--version"):
return path
except Exception:
pass
+ try:
+ path = f"{tool}"
+ out = subprocess.Popen(
+ f"{path} {test}",
+ shell=True,
+ stderr=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ )
+ out.communicate()
+ if out.returncode == 0:
+ return path
+ except Exception:
+ pass
return ""
|
My understanding from the PR is that it tries first arch-prefixed binaries, and then the tool without prefix as final fallback. So I would expect it to still be able to call a |
Currently, if prefix is set to something like |
But checking for all tools, like |
get_mingw_tool
to fix mingw prefix ambiguityget_mingw_tool
to fix mingw prefix ambiguity (reverted)
Expands upon the #79871 fix. Instead of separately checking for if a tool exists with/without a prefix, and using that to manually check for a tool, this PR consolidates that logic into a single function:
get_mingw_tool
. Now it returns a path outright to whatever tool it finds, or an empty path if no tool was found whatsoever. Because an empty string will function asFalse
in conditionals, this was sufficent to remove the need forget_mingw_bin_prefix
in isolation & replacetry_cmd
outrightThe primary change compared to
try_cmd
is that only the leading argument needs to be supplied; as such, the argument was renamed from "test" to "tool".--version
is now implicitly what gets tested, but can be changed if needed via a new argument. This new function was applied to all the areas whereget_mingw_bin_prefix
and/ortry_cmd
were directly called, consolidating the relevant code in the process