Skip to content

Only warn about duplicate script engines - #65

Merged
ctrueden merged 1 commit into
masterfrom
duplicate-script-engines
May 21, 2014
Merged

ctrueden merged 1 commit into
masterfrom
duplicate-script-engines

Conversation

@dscho

@dscho dscho commented May 20, 2014

Copy link
Copy Markdown
Contributor

Once we have a Python script engine based on real Python (started in
https://github.com/scijava/scripting-cpyton), we will want to avoid
erroring out when there are two implementations for the same name,
and instead let the implementation with the higher priority win.

Signed-off-by: Johannes Schindelin johannes.schindelin@gmx.de

@dscho

dscho commented May 20, 2014

Copy link
Copy Markdown
Contributor Author

@ctrueden could you have a look and merge if you find it okay?

@LeeKamentsky

Copy link
Copy Markdown
Member

Hi guys, I'm thinking that CPython and Jython are two different beasts and that it's reasonable to choose one or the other. Maybe you still only want to warn, but also maybe you want CPython and Jython to have two different names?

Once we have a Python script engine based on real Python (started in
https://github.com/scijava/scripting-cpyton), we will want to avoid
erroring out when there are *two* implementations for the same name,
and instead let the implementation with the higher priority win.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho

dscho commented May 21, 2014

Copy link
Copy Markdown
Contributor Author

Also, are you certain you want the CPython language to share the same name as the Jython language?

The problem is not so much the name. The problem is the file extension, actually. We already have a number of .py scripts that users expect to be executed properly. So we need to make sure that those scripts are executed by CPython the same as they would be executed by Jython, I guess.

@dscho

dscho commented May 21, 2014

Copy link
Copy Markdown
Contributor Author

Also: we cannot simply rename the language "Python" to "Jython" in scripting-jython because that would change the language entry in the script editor, and as a consequence we would have a very hard time explaining to Fiji users why the new script editor does not have their beloved Python anymore.

Even worse: once we have cpython, the "Python" language would not at all be executed by the same interpreter anymore!

So I am really in favor of just warning the user. It means also that we need a way for users to override compiled-in priorities so they can force one over the other language interpreter.

What we should do in any case is to add more names to the interpreters, in addition to "Python". Jython should return both "Python" and "Jython", cpython should return both "Python" and "CPython".

@ctrueden

Copy link
Copy Markdown
Member

Should we support something like #!/usr/bin/env jython etc. headers as a hint for which interpreter to use?

@dscho

dscho commented May 21, 2014

Copy link
Copy Markdown
Contributor Author

Should we support something like #!/usr/bin/env jython [...]

That would suggest that the scripts are actually to be executable from the command-line (which is a different thing altogether, something we still might want to support, but in addition to the issue at hand).

Besides, it will interfere with the @Parameter handling of scripts...

@dscho

dscho commented May 21, 2014

Copy link
Copy Markdown
Contributor Author

@ctrueden

Copy link
Copy Markdown
Member

@dscho wrote:

That would suggest that the scripts are actually to be executable from the command-line (which is a different thing altogether, something we still might want to support, but in addition to the issue at hand).

My point is that we could have some sort of header indicating the preferred interpreter. It doesn't have to be #! specifically.

Besides, it will interfere with the @parameter handling of scripts...

Improving the parameter handling to support this would be rather trivial, so that is a non-issue.

@dscho

dscho commented May 21, 2014

Copy link
Copy Markdown
Contributor Author

Okay, fine, I still want to merge this pull request, though... ;-)

Objections?

@ctrueden

Copy link
Copy Markdown
Member

Oh yeah, as we briefly discussed, I am on board with this change. Sorry to give an impression otherwise. The main thing I was hesitant about (why I didn't just merge it) is the behavior of the gently flag. But if you think the way things are is good, then...

ctrueden added a commit that referenced this pull request May 21, 2014
Only warn about duplicate script engines
@ctrueden
ctrueden merged commit 1b9bd3f into master May 21, 2014
@ctrueden
ctrueden deleted the duplicate-script-engines branch May 21, 2014 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants