-
-
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: Convert platform get_flags
to dictionary
#92124
SCons: Convert platform get_flags
to dictionary
#92124
Conversation
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.
Makes sense! Definitely improves readability :D
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.
This looks great. It certainly helps the readability of the flags section for platform code.
In general this makes a lot of sense, but I'm a bit concerned that it's compat breaking for third-party platform ports: consoles, homebrews, embedded devices, etc. I can say from the W4 side that it's a change we're happy to carry over downstream, but I can't make that decision for all other third-parties, who may be trying to support multiple Godot minor releases for the same codebase (with a few occasionally I just had a quick look and it seems possible to preserve compatibility downstream by doing a Godot version check like this: def get_flags():
import version
if (version.major, version.minor) < (4, 3):
return [
("arch", detect_arch()),
("supported", ["mono"]),
]
else:
return {
"arch": detect_arch(),
"supported": ["mono"],
} So I think it's fine for now, I'm not aware of downstream ports that would want to support multiple versions, but if some do, they can use a similar snippet to achieve that. We should keep this in mind if we ever want to make |
Note, one other option would be to add compat code ourselves in We had to do that in the past when change the expected arguments of the modules' |
3160ef9
to
896b003
Compare
A compatibility check was easy enough to implement: platform_flags[x] = detect.get_flags()
if isinstance(platform_flags[x], list): # backwards compatibility
platform_flags[x] = {flag[0]: flag[1] for flag in platform_flags[x]} |
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 great!
Thanks! |
Minor formatting update to make
get_flags
return a dictionary instead of a tuple array, as it's already being parsed as if it were a dictionary.