Use .py3 extension to avoid clashes with built-in script provider.#44
Open
nneonneo wants to merge 3 commits intomandiant:mainfrom
Open
Use .py3 extension to avoid clashes with built-in script provider.#44nneonneo wants to merge 3 commits intomandiant:mainfrom
nneonneo wants to merge 3 commits intomandiant:mainfrom
Conversation
There are actually useful plugins written in Jython with Python 2 syntax. It's very inconvenient to be unable to run these scripts. Upgrading isn't completely straightforward either: for example, Jython supports shortcut syntax like `obj.property` instead of `obj.getProperty()` while JEP does not. This patch makes Ghidrathon only handle scripts with the .py3 extension. This only affects the script entry point; imported modules should 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.
Author
|
I'm aware this is an obvious breaking change, but I'm hoping that you're open to the change. The alternative is that Python 2 (Jython) scripts are simply unusable with the Ghidrathon extension installed, which isn't great. I imagine that even if Ghidra ever gains a Python 3 interpreter, there will still need to be some mechanism to distinguish Python 2 scripts from Python 3 scripts for compatibility with existing scripts. |
|
As of Ghidra 11.2, the proper way to avoid clashes is to extend |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.propertyinstead 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.