Is there a way to run some code in a package.py at resolve time to decide whether the package should be considered or not? #1403
Unanswered
herronelou
asked this question in
Q&A
Replies: 1 comment
-
@herronelou Did you find a solution to this? I figured out a workaround that kindof works, though it is very hacky. In an "early" function try to detect if the DCC is installed. If it isn't, change the variant list such that this package only has a variant for some non-existent variant of another package. In this case I've chosen to use "arch" because it's a package that is always present. And I've arbitrarily chosen "disabled" as my non-existent variant. For example: @early
def variants():
if not some_condition:
return [['arch-disabled']]
return [] A more complete example: @early
def find_maya():
# Try to find Maya here and return the path.
return ""
@early
def variants():
if not this.find_maya:
return [['arch-disabled']]
return []
def commands():
env.PATH.append(this.find_maya) I'm curious if someone has a better way to handle this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello.
For a lot of our DCCs, we made empty packages that are only pointing at local install files of the software.
Currently, I have a check in the commands section to display an error when the required package is not actually installed locally, but the package still resolves.
I would like to run a little check at resolve time so that if the local install doesn't exist, rez considers the package to not exist, and continues to resolve until it finds a version that satisfies all conditions.
Is there such an option? I can't seem to figure it out from reading the wiki.
Beta Was this translation helpful? Give feedback.
All reactions