-
Notifications
You must be signed in to change notification settings - Fork 336
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
Adds PlatformDependent factory. #739
base: main
Are you sure you want to change the base?
Adds PlatformDependent factory. #739
Conversation
Hey Blazej, Fantastic idea, I like it. I can see how this would simplify setting definitions with nested dicts. I have some suggestions though:
We would still have PlatformDependent etc, but that would just be a specific case of Conditional. |
Very glad you like it. I also had a good feeling about it. |
3c5e673
to
e5e289d
Compare
+Added tests for using in a config file. This exposed the recursive import mentioned above. |
I was thinking about what would be necessary to make |
cb1544b
to
d483050
Compare
This is doing what one would expect. However due to the nature of platform_map I need to use inspect. All the different types are visible in the unit tests. Also removed the platform_mapped decorator which make the code easier. |
Last thing I might do is use the inspect only in the bound class. This way there shouldn't be any wrong results. |
d4e59e8
to
29bc81a
Compare
Ok this is much better. Ignore the past discussion.
# This is a rezconfig.py
platform_map = {
"arch": {
".*": "IMPOSSIBLE_ARCH",
},
}
prune_failed_graph = ArchDependent({
"IMPOSSIBLE_ARCH": True,
})
config.override(
"prune_failed_graph",
ArchDependent(
{
"IMPOSSIBLE_ARCH": True,
},
platform_map=config.platform_map
)
)
EDIT:
|
Tests passing
|
I have some failing tests on Windows in this branch (on py3.7), is this the right place for those? Granted, it's far fewer failing tests than is currently in master, so that doesn't have to be a blocker. |
So there's a problem I can see that I think has to be fixed. While Os/ArchDependent does respect platform_map, it only does so if platform_map is defined in the same config. The problem with this is, it would not be at all unreasonable for a studio to define platform_map in some root rezconfig.py, and then have various overrides in a second rezconfig.py (you can specify multiple, and they get merged together). In that scenario, any OsDependent used in the second rezconfig would not work as expected. I think I can see a reasonable fix though - it isn't perfect, but good enough I reckon. What we need to do is, in I think this should be a fairly trivial fix. It's not perfect in the sense that OsDependent won't be aware of platform_map being redefined in a config later in the searchpath - but I think the chances of that being done are low, and it's not that unreasonable for OsDependent to only know about platform_map as it's been defined up to that point in the config searchpath. ps - We could also provide a reserved |
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.
See last comment
The only tests that are expected to fail are the cmake related ones. |
These are my other (non-py3-specific) test case failures at the moment.
|
I think this one is not related to this PR but we can be sure by holding this one off until the Windows tests PR changes are in: #775 #781 I'll be looking at Allan's requests next. |
29bc81a
to
305d47a
Compare
If you don't mind let's have the I am still trying to figure what went wrong with Python 3.x ... |
273dd45
to
c07bc4f
Compare
Should be in a pretty good shape now. |
c07bc4f
to
2665518
Compare
@maxnbk I fixed the issues you had (I hope). |
2665518
to
2b3ceeb
Compare
Moved the test to test_utils. |
Hey @bfloch, just getting back to this now, apologies for the delay. There's only a couple of minor changes I would make. I don't mind doing them myself as part of the merge, as they're fairly trivial.
cheers |
Allow to specify any value in rezconfig based on platform or any other key. Tests and documentation included.
Since the conditionals can be called within a config, and this config might have a platform_map we try to respect it best we can. In an config.override() the containing configuration can not be known so it needs to be passed explicitly.
This makes less assumptions. No need to have introduced a decorator for two functions only (original author speaking).
Before it would affect the general use of the classes so I made the particular case where these Conditionals are bound explicit classes.
In python 3 the caught execption is not recoverable in an override. Since we are testing for expected failure it is probably ok to not expect any tests after the failure to pass.
2b3ceeb
to
2b5096f
Compare
Just rebased and resolved conflict with current master. I'll be looking into your feedback shortly. Sounds minimal and it seems we might be wanting to use this shortly which will also give us some real world feedback. P.S. Nice how far all of you pushed the GH actions! |
Hey cheers Blazej, I'll get back onto this soon.
…On Wed, 2 Sep. 2020, 15:49 Blazej Floch, ***@***.***> wrote:
Just rebased and resolved conflict with current master. I'll be looking
into your feedback shortly. Sounds minimal and it seems we might be wanting
to use this shortly which will also give us some real world feedback.
P.S. Nice how far all of you pushed the GH actions!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#739 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMOUSWLGEZSDAAZLEACO2TSDXMHVANCNFSM4IU6L54Q>
.
|
EDIT: See last comments for updated version for review.
Allow to specify any value in rezconfig based on platform.
Tests and documentation included.
Samples from documentation:
*
can be used as fallback key.By default it matches the
platform_.name
. This can be changed by specifyingattr
as any otherplatform_
attribute:I haven't tried but this could be even chained for more complex rules.
Backwards compatibility