Use .py3 extension to avoid clashes with built-in script provider. #44
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are actually useful scripts written in Jython with Python 2 syntax. It's very inconvenient to be unable to run these scripts with Ghidrathon installed. Upgrading existing scripts isn't completely straightforward either: for example, Jython supports shortcut syntax like
obj.property
instead ofobj.getProperty()
while JEP does not; never mind all of the little incompatibilities between Py2 and Py3.This patch makes Ghidrathon only handle scripts with the .py3 extension. This only affects the script entry point; imported modules still use the .py extension as usual. Thus, the practical impact should be quite minimal. .py3 also serves to explicitly document that a script requires Ghidrathon to run.
With this patch, it is no longer necessary to disable the default script provider, and in fact you can use both Python 2 (Jython) scripts and Python 3 (Ghidrathon/JEP) scripts without any issues.
It's fairly straightforward to configure an editor to support .py3 just like .py. An alternative design would be to handle a double extension like .3.py, but that solution is uglier and will still require some kind of hack to prevent the existing script provider from handling them.