Yeah I also had trouble with weak references for that situation.
You can use the @late() decorator on the requires() function of your package.
@late()
def requires():
packages = ['package_to_load']
if in_context() and 'houdini' in request and
request['houdini'] == "houdini-16.0.312":
packages.append('package_to_load_only_for_houdini_16')
return packages
But know that this method will make the commands rez-depends and
rez-search behave differently for that package. I'm still
hesitating to use this in production yet for that reason.
--
You received this message because you are subscribed to the Google Groups "rez-config" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rez-config+...@googlegroups.com.
To post to this group, send email to rez-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/rez-config.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to rez-config+unsubscribe@googlegroups.com.
To post to this group, send email to rez-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/rez-config.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "rez-config" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rez-config+unsubscribe@googlegroups.com.
import os
import platform
name = "foo"
version = "1.0.0"
requires = ["bar"]
optional_requires = ["moo"]
build_requires = []
variants = []
uuid = "7d685c22175b41e4a7471b0f4484eceb"
# cheap imp for 'optional_requires': only include
# opt pkgs if they exist (a bit whacky as it runs
# another 'rez-env' as shell cmd)
silencer = r"> nul 2>&1" if platform.system().lower() == "windows" else r"> /dev/null 2>&1"
for optional_require in optional_requires:
try:
p = os.popen("rez-env -q %s -c \"exit 0\" %s" % (optional_require, silencer))
ret = p.close()
except:
ret = 1
if ret == None:
requires.append(optional_require)
def commands():
pass
--
You received this message because you are subscribed to the Google Groups "rez-config" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rez-config+...@googlegroups.com.
--
When running rez-env testpackage houdini-16 it should resolve both of them, but I would expect rez-env testpackage houdini-15 to skip the testpackageThat is not at all what I would ever expect rez to do. Rez gives you the packages you asked for, and you asked for `testpackage`. The result should either be a valid resolved env, or failure.If what you want is "require this package [version range] only if it exists", then I could see that this might be useful. I would manage this by introducing a new syntax (maybe `~~foo`?). But bear in mind that this could introduce a lot of extra complexity (you have consider the changes to the solver, and ambiguous cases that may arise). It isn't clear to me if this feature is worth the potential development cost.A
On Thu, Apr 19, 2018 at 8:03 PM Dani Asztalos <asztal...@gmail.com> wrote:
Hi,--Can I make a package request optional? I want to include a package if it is resolvable, but I don't mind skipping it.E.g:I have these houdini versionshoudini-15.5.532
houdini-15.5.623
houdini-16.0.312Then I have a package testpackage, with only houdini-16.0 variant.When running rez-env testpackage houdini-16 it should resolve both of them, but I would expect rez-env testpackage houdini-15 to skip the testpackage.Something like Weak references, but this does not seem to do the trick. Of course I could make an empty houdini-15 variant for the testpackage, but I hope there is a better solution.Thanks,Daniel
You received this message because you are subscribed to the Google Groups "rez-config" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rez-c...@googlegroups.com.