-
Notifications
You must be signed in to change notification settings - Fork 732
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
Add hooks in quarks #5780
Add hooks in quarks #5780
Conversation
hook = hook.asSymbol; | ||
if(this.data[hook].notNil, { | ||
"Run % hook".format(hook).postln; | ||
this.data[hook].(); |
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.
Consider wrapping the hook callback in a try
with a more specific error message? I don't think we can totally protect or clean-up in case of an error while calling a hook, but it would be good to report errors as something more than a random sclang exception (these are hard enough interpret for people....). I'm imagining something like this would be enough:
try {
this.data[hook].value();
} {
|e|
"Encountered error while running hook '%' for Quark('%'). Installation or update for this Quark may not have completed correctly.".warn;
e.throw(); // re-throw
}
Thanks for the feedback @scztt - do you think the additional commits are sufficient? if so, I'll start to write docs for it :) |
Added tests, but not all tests are passing, e.g. FAIL: a TestCoreUGens: test_ugen_generator_equivalences - "Duty.ar(SampleDur.ir, 0, x) == x"
1 of 48000 items in array failed to match. Displaying arrays from index of first failure (0) onwards:
FloatArray[ 0.60310339927673, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0....etc...
! =
0 but it seems this was not broken by this PR |
Anything thats missing from a merge? |
@scztt - how are you feeling with the changes? |
Should this be considered for https://github.com/supercollider/supercollider/milestone/24 ? Makes sense to me to include it in an major version upgrade, making it easy for checking if this hook functionality is existing. |
@scztt just checking in, would you be able to follow up on your review? |
@capital-G I saw that scott had some comments in the review – have you checked them? |
Bump |
|
Yes, I documented this behavior, see this comment #5780 (comment) |
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 good to me now.
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.
Thanks for the PR @capital-G !
I wanted to merge this but I noticed that the tests did not run in the CI (that sometimes happens) so I've run the tests locally after building from this branch and there were some failures. Could you please check and fix the tests?
RUNNING UNIT TEST 'TestQuark'
-> TestQuark
PASS: a TestQuark: test_parseQuarkFileHooksAsFunction - Hook 'preInstall' should be parsed as function
PASS: a TestQuark: test_parseQuarkFileHooksAsFunction - Hook 'postInstall' should be parsed as function
PASS: a TestQuark: test_parseQuarkFileHooksAsFunction - Hook 'preUpdate' should be parsed as function
PASS: a TestQuark: test_parseQuarkFileHooksAsFunction - Hook 'postUpdate' should be parsed as function
PASS: a TestQuark: test_parseQuarkFileHooksAsFunction - Hook 'preUninstall' should be parsed as function
PASS: a TestQuark: test_parseQuarkFileHooksAsFunction - Hook 'postUninstall' should be parsed as function
Installing TestQuark
Run preInstall hook
Run postInstall hook
TestQuark installed
FAIL: a TestQuark: test_runQuarkInstallHooks - Check if hook 'preInstall' was called
FAIL: a TestQuark: test_runQuarkInstallHooks - Check if hook 'postInstall' was called
PASS: a TestQuark: test_parseQuarkFileData - Quark name should be parsed from quark file
PASS: a TestQuark: test_parseQuarkFileData - Quark version should be parsed from quark file
UNIT TESTS FOR 'TestQuark' COMPLETED
There were failures:
a TestQuark: test_runQuarkInstallHooks - Check if hook 'preInstall' was called
a TestQuark: test_runQuarkInstallHooks - Check if hook 'postInstall' was called
BTW we are planning to do a release candidate for 3.13 this weekend. I'll add this to the milestone so that it doesn't fall off the radar. |
@dyfer seems like the CI has completed, so you can resolve that request. |
@telephon Because of this I have built this PR locally and noticed that some tests fail. If I missed something, please let me know. |
The tests were broken when I created the branch - should i merge or rebase (what is better in this scenario?) the main branch, this should trigger the test suite with the proper changes right - if it works its fine, if it fails than it shouldnt be merged. |
@capital-G Please take a look at my message above. I've only run tests added in this PR ( |
Oh, I oversaw the details section, thanks for the hint, will fix this. |
@capital-G why did you close this? I think the tests probably just make some wrong assumption. If you like, we can look through it. |
See bottom of #5487 (comment) |
@telephon yes, I was planning to do that. Since we just did 3.13.0-rc1, I'm trying to decide whether we should make 3.13.0-rc2 with that, or should that PR wait until 3.13.1. Technically I think new functionality shouldn't be added from one rc to the next, but this is relatively small and I was hoping it would be included... So, I'm planning for #5907 to go into 3.13.1 at the latest, but possibly earlier. |
Purpose and Motivation
Implements #5753
Before writing docs and tests I want to make sure that this implementation is fine.
I switched form upgrade->update and remove->uninstall terminology in order to reflect more the terminology used within SuperCollider than in pacman.
Types of changes
To-do list