Update scripter to allow running of scripts without a main() function
ClosedPublic

Authored by brendanbd on Dec 13 2017, 8:56 PM.

Details

Summary

Allow scripter to play main()-less scripts without complaining

If a script is typed into the scripter window interactively and saved, scripter keeps a record of the file and automatically loads the script on the next run. When you press play on this auto-loaded script the runner module tries to load the module, then run it's main() method. However, an interactive script may not have a main method. Scripter should run main() if it's present, but fail silently if it is not present.

Test Plan

Not sure what to put here.
To trigger the initial bug Run krita, run scripter, create a script without main, save the script then press the play button.

Diff Detail

Repository
R37 Krita
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
brendanbd created this revision.Dec 13 2017, 8:56 PM
Restricted Application added a subscriber: woltherav. · View Herald TranscriptDec 13 2017, 8:56 PM
brendanbd requested review of this revision.Dec 13 2017, 8:56 PM

It's ok to me, that makes sense.

rempt added a subscriber: rempt.Dec 15 2017, 1:34 PM

Eliakin,

Can you push it for brendan? He hasn't got commit access yet.

woltherav accepted this revision.Dec 15 2017, 1:50 PM

lets accept, otherwise this won't close later on.

This revision is now accepted and ready to land.Dec 15 2017, 1:50 PM
In D9317#179843, @rempt wrote:

Eliakin,

Can you push it for brendan? He hasn't got commit access yet.

It's ok. I will push saturday at night (Brazil)

Please also close bug https://bugs.kde.org/show_bug.cgi?id=387702 with the commit (add a line BUG: 387702 to the end of the commit message).
(And add a line Differential Revision: https://phabricator.kde.org/D9317 after it to close this review.)

This revision was automatically updated to reflect the committed changes.