-
Notifications
You must be signed in to change notification settings - Fork 2.4k
"run_after" and "when" decorator are incompatible with each other #12736
Description
Using both the @when and @run_after decorator on the same method results in weird errors, depending on the order in which they're used.
Steps to reproduce the issue
Use both decorators on the same method, like:
@run_after('configure')
@when('platform=darwin')
def filter_rt(self):
# Don't link with -lrt; the system has no (and needs no) librt
filter_file(r' -lrt$', '', 'Makefile')Error Message
Reporting the error description from a conversation with "Sly" on Slack:
I've tried it with the Git package by putting the two decorators on different lines. Having the
@run_after('install')first results in the function trying to run even when the variant is not included and erroring out withError: NoSuchMethodError: Package Git does not support install_subtree called with [email protected]%[email protected]~subtree~tcltk. Having the@when('+variantX')is first, it always runs the function and installs the functionality, regardless of whether the variant is included or not. The only way I've gotten to work in an expected manner is just having@run_after('install')and having anif '+variantX' in self.spec:conditional inside the function.
Information on your system
Should not be relevant