From 5f4fce77dff4375ff5de73016ba2a1f16e66d7b8 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 11 Feb 2015 07:03:12 -0600 Subject: [PATCH 01/94] Happy belated New Year 2015 --- LICENSE.txt | 2 +- .../org/scijava/plugins/scripting/jython/JythonBindings.java | 2 +- .../scijava/plugins/scripting/jython/JythonScriptEngine.java | 2 +- .../scijava/plugins/scripting/jython/JythonScriptLanguage.java | 2 +- .../java/org/scijava/plugins/scripting/jython/JythonTest.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index e896c7f..cce13af 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2008 - 2014, Board of Regents of the University of +Copyright (c) 2008 - 2015, Board of Regents of the University of Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. All rights reserved. diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java index 595f85a..3d6a493 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2014 Board of Regents of the University of + * Copyright (C) 2008 - 2015 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java index 8fdee6c..bd710b8 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2014 Board of Regents of the University of + * Copyright (C) 2008 - 2015 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index 0cf9e24..84e4664 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2014 Board of Regents of the University of + * Copyright (C) 2008 - 2015 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java index b86143a..74ff47a 100644 --- a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java +++ b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2014 Board of Regents of the University of + * Copyright (C) 2008 - 2015 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% From a86cdc903aba336fefc5110b90ae706835e16ef6 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Wed, 25 Feb 2015 10:22:31 -0600 Subject: [PATCH 02/94] Move script-templates to script_templates This fixes a conflict with javadoc generation not handling "-" characters in directories. --- .../{script-templates => script_templates}/Python/Greeting.py | 0 .../{script-templates => script_templates}/Python/Hello_World.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/{script-templates => script_templates}/Python/Greeting.py (100%) rename src/main/resources/{script-templates => script_templates}/Python/Hello_World.py (100%) diff --git a/src/main/resources/script-templates/Python/Greeting.py b/src/main/resources/script_templates/Python/Greeting.py similarity index 100% rename from src/main/resources/script-templates/Python/Greeting.py rename to src/main/resources/script_templates/Python/Greeting.py diff --git a/src/main/resources/script-templates/Python/Hello_World.py b/src/main/resources/script_templates/Python/Hello_World.py similarity index 100% rename from src/main/resources/script-templates/Python/Hello_World.py rename to src/main/resources/script_templates/Python/Hello_World.py From 5d85363d748fca967605499909a1ace2660f5ab5 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Wed, 25 Feb 2015 13:55:14 -0600 Subject: [PATCH 03/94] Bump to pom-scijava 5.9.0 Updated to latest parent pom. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5727a41..0e7a96f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 3.4 + 5.9.0 From 8244a6579edfb711bfe49945f31f05939bc988e5 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Wed, 25 Feb 2015 14:19:44 -0600 Subject: [PATCH 04/94] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0e7a96f..b0b7983 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.1.5-SNAPSHOT + 0.2.1-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From c235cd5852fc97727f81fe4af74a45dbc57b6a22 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Thu, 26 Feb 2015 14:17:01 -0600 Subject: [PATCH 05/94] Bump to pom-scijava 5.10.0 Includes a fixed scijava-common dependency. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b0b7983..d5138b7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 5.9.0 + 5.10.0 From cf48d85e19992e8b67298de8a7537d8a12fb22d1 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 28 Apr 2015 23:03:35 -0500 Subject: [PATCH 06/94] README.md: add Jenkins build status badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9951263..1510948 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![](http://jenkins.imagej.net/job/scripting-Jython/lastBuild/badge/icon) + # Jython Scripting This library provides a From c75e61810acf7a7e413fb6d30ea7b62df8c27a1f Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 28 Apr 2015 23:23:34 -0500 Subject: [PATCH 07/94] POM: fix Jenkins URL (http, not https) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d5138b7..26f5e11 100644 --- a/pom.xml +++ b/pom.xml @@ -77,7 +77,7 @@ Jenkins - https://jenkins.imagej.net/job/scripting-Jython/ + http://jenkins.imagej.net/job/scripting-Jython/ From 2c78768034a60bea8e58246b7fc566633395fe25 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 29 Apr 2015 14:45:31 -0500 Subject: [PATCH 08/94] README.md: link Jenkins badge to the job --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1510948..d9a2943 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![](http://jenkins.imagej.net/job/scripting-Jython/lastBuild/badge/icon) +[![](http://jenkins.imagej.net/job/scripting-Jython/lastBuild/badge/icon)](http://jenkins.imagej.net/job/scripting-Jython/) # Jython Scripting From ba3e66044cfe3b5caadd60fbd3c48fc486a829cf Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Thu, 30 Apr 2015 08:46:30 -0500 Subject: [PATCH 09/94] Greeting.py: add property examples Add a label and description to the name parameter. --- src/main/resources/script_templates/Python/Greeting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/script_templates/Python/Greeting.py b/src/main/resources/script_templates/Python/Greeting.py index a08cce7..eaeb754 100644 --- a/src/main/resources/script_templates/Python/Greeting.py +++ b/src/main/resources/script_templates/Python/Greeting.py @@ -1,4 +1,4 @@ -# @String name +# @String name (label=Please enter your name,description=Name field) # @OUTPUT String greeting # A Jython script with parameters. From 93cfd07eb8560ee899a49c66c9d07dfa5a470f77 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Thu, 30 Apr 2015 13:24:20 -0500 Subject: [PATCH 10/94] Make String properties more future-proof This is the recommended way to list properties, which should be compatible with any future CSV-parser. --- src/main/resources/script_templates/Python/Greeting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/script_templates/Python/Greeting.py b/src/main/resources/script_templates/Python/Greeting.py index eaeb754..210aaa6 100644 --- a/src/main/resources/script_templates/Python/Greeting.py +++ b/src/main/resources/script_templates/Python/Greeting.py @@ -1,4 +1,4 @@ -# @String name (label=Please enter your name,description=Name field) +# @String(label="Please enter your name",description="Name field") name # @OUTPUT String greeting # A Jython script with parameters. From 877c717224421e3732f02e350968d60c963a6d43 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Fri, 1 May 2015 11:51:54 -0500 Subject: [PATCH 11/94] Bump to pom-scijava 7.1.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 26f5e11..bf4539c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 5.10.0 + 7.1.0 From 1603a0ebfef6dfc9151147b420cc5a90016e001d Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Fri, 1 May 2015 11:53:50 -0500 Subject: [PATCH 12/94] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bf4539c..c25223d 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From 2a4d4dcc9f58c04ac31150eb8bb941f13deb9dd6 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 2 Jun 2015 11:04:59 +0200 Subject: [PATCH 13/94] Unwrap Python objects when they wrap Java ones This avoids, e.g., PyObjectDerived objects coming out of the script engine after script execution. --- .../plugins/scripting/jython/JythonScriptLanguage.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index 84e4664..627fe6c 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -34,6 +34,7 @@ import javax.script.ScriptEngine; import org.python.core.PyNone; +import org.python.core.PyObject; import org.scijava.plugin.Plugin; import org.scijava.script.AdaptedScriptLanguage; import org.scijava.script.ScriptLanguage; @@ -59,7 +60,14 @@ public ScriptEngine getScriptEngine() { @Override public Object decode(final Object object) { - return object instanceof PyNone ? null : object; + if (object instanceof PyNone) return null; + if (object instanceof PyObject) { + // Unwrap Python objects when they wrap Java ones. + final PyObject pyObj = (PyObject) object; + final Class javaType = pyObj.getType().getProxyType(); + if (javaType != null) return pyObj.__tojava__(javaType); + } + return object; } } From cf8d43b6528a75b7ce77edc96c3db470e291f24b Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 3 Jun 2015 08:59:11 +0200 Subject: [PATCH 14/94] Unwrap Python strings to Java strings --- .../plugins/scripting/jython/JythonScriptLanguage.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index 627fe6c..7cf4fda 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -35,6 +35,7 @@ import org.python.core.PyNone; import org.python.core.PyObject; +import org.python.core.PyString; import org.scijava.plugin.Plugin; import org.scijava.script.AdaptedScriptLanguage; import org.scijava.script.ScriptLanguage; @@ -67,6 +68,9 @@ public Object decode(final Object object) { final Class javaType = pyObj.getType().getProxyType(); if (javaType != null) return pyObj.__tojava__(javaType); } + if (object instanceof PyString) { + return ((PyString) object).getString(); + } return object; } From eb7d73ea6f5ee35e6e6c3aa1b7c823caf2e4e71b Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Mon, 15 Jun 2015 11:27:29 -0500 Subject: [PATCH 15/94] Bump parent to pom-scijava 7.3.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c25223d..9f784dc 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 7.1.0 + 7.3.1 From 07f46a5c1273bdc539ff2ec22c8a8b6cb9f2fb5c Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Mon, 15 Jun 2015 12:33:21 -0500 Subject: [PATCH 16/94] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9f784dc..f8c8d42 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From bdabd1a0078cedccd6a9875cec31d2d7ee2a800b Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 19 Nov 2015 08:51:16 -0600 Subject: [PATCH 17/94] POM: remove excess whitespace This makes tidy-maven-plugin happy. --- pom.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pom.xml b/pom.xml index f8c8d42..557e5ca 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,6 @@ JSR-223-compliant Jython scripting language plugin. http://scijava.org/ 2008 - Simplified BSD License @@ -69,12 +68,10 @@ HEAD https://github.com/scijava/scripting-jython - GitHub Issues https://github.com/scijava/scripting-jython/issues - Jenkins http://jenkins.imagej.net/job/scripting-Jython/ @@ -126,5 +123,4 @@ Institute of Molecular Cell Biology and Genetics. - From c2183e0ed8c9f7954fa6e53b3a76219057d0c762 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 19 Nov 2015 10:38:37 -0600 Subject: [PATCH 18/94] POM: remove redundant mailingLists section It is inherited from the pom-scijava parent. --- pom.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pom.xml b/pom.xml index 557e5ca..c374ece 100644 --- a/pom.xml +++ b/pom.xml @@ -52,16 +52,6 @@ - - - SciJava - https://groups.google.com/group/scijava - https://groups.google.com/group/scijava - scijava@googlegroups.com - https://groups.google.com/group/scijava - - - scm:git:git://github.com/scijava/scripting-jython scm:git:git@github.com:scijava/scripting-jython From 8654262fb29ec94739eeadf60ea4ed0e98f86463 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 19 Nov 2015 11:00:00 -0600 Subject: [PATCH 19/94] POM: update developers and contributors See: http://imagej.net/Team --- pom.xml | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index c374ece..1481363 100644 --- a/pom.xml +++ b/pom.xml @@ -25,32 +25,48 @@ - dscho - Johannes Schindelin - schindelin@wisc.edu - http://loci.wisc.edu/people/johannes-schindelin + ctrueden + Curtis Rueden + ctrueden@wisc.edu + http://loci.wisc.edu/people/curtis-rueden UW-Madison LOCI http://loci.wisc.edu/ - architect + lead developer + debugger + reviewer + support + maintainer -6 - ctrueden - Curtis Rueden - ctrueden@wisc.edu - http://loci.wisc.edu/people/curtis-rueden + hinerm + Mark Hiner + hiner@wisc.edu + http://loci.wisc.edu/people/mark-hiner UW-Madison LOCI http://loci.wisc.edu/ - architect + lead developer + debugger + reviewer + support + maintainer -6 + + + Johannes Schindelin + http://imagej.net/User:Schindelin + founder + dscho + + scm:git:git://github.com/scijava/scripting-jython From 5f55c08cedf38d0ee3818056223de6c41e037cb3 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 19 Nov 2015 11:00:01 -0600 Subject: [PATCH 20/94] POM: bump parent to pom-scijava 9.0.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1481363..acdcb64 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 7.3.1 + 9.0.0 From 9e81c537444e971a70172a0ed6834f7045739caa Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 19 Nov 2015 12:55:18 -0600 Subject: [PATCH 21/94] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index acdcb64..f43bee2 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From 0444100e78129562791629501bbf9185877d4616 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Mon, 14 Dec 2015 14:42:53 -0600 Subject: [PATCH 22/94] JythonScriptLanguage: clean interpreter Uses PhantomReferences to clean up after the interpreter --- .../jython/JythonScriptLanguage.java | 94 ++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index 7cf4fda..236c4cc 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -31,14 +31,23 @@ package org.scijava.plugins.scripting.jython; +import java.lang.ref.PhantomReference; +import java.lang.ref.ReferenceQueue; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + import javax.script.ScriptEngine; import org.python.core.PyNone; import org.python.core.PyObject; import org.python.core.PyString; +import org.python.util.PythonInterpreter; +import org.scijava.plugin.Parameter; import org.scijava.plugin.Plugin; import org.scijava.script.AdaptedScriptLanguage; import org.scijava.script.ScriptLanguage; +import org.scijava.thread.ThreadService; /** * An adapter of the Jython interpreter to the SciJava scripting interface. @@ -49,6 +58,14 @@ @Plugin(type = ScriptLanguage.class, name = "Python") public class JythonScriptLanguage extends AdaptedScriptLanguage { + private final LinkedList phantomReferences = + new LinkedList(); + private final ReferenceQueue queue = + new ReferenceQueue(); + + @Parameter + private ThreadService threadService; + public JythonScriptLanguage() { super("jython"); } @@ -56,7 +73,51 @@ public JythonScriptLanguage() { @Override public ScriptEngine getScriptEngine() { // TODO: Consider adapting the wrapped ScriptEngineFactory's ScriptEngine. - return new JythonScriptEngine(); + final JythonScriptEngine engine = new JythonScriptEngine(); + + synchronized (phantomReferences) { + phantomReferences.add(new JythonEnginePhantomReference(engine, queue)); + + // If we added references to an empty queue, we need to start + // a new polling thread + if (phantomReferences.size() == 1) { + threadService.run(new Runnable() { + + @Override + public void run() { + boolean done = false; + + // poll the queue + while (!done) { + try { + Thread.sleep(100); + + synchronized (phantomReferences) { + JythonEnginePhantomReference ref = + (JythonEnginePhantomReference) queue.poll(); + + // if we have a ref, clean it up + if (ref != null) { + ref.cleanup(); + phantomReferences.remove(ref); + } + + // Once we're done with our known phantom refs + // we can shut down this thread. + done = phantomReferences.size() == 0; + } + + } + catch (final Exception ex) { + // log exception, continue + } + } + } + }); + + } + } + return engine; } @Override @@ -74,4 +135,35 @@ public Object decode(final Object object) { return object; } + private static class JythonEnginePhantomReference extends + PhantomReference + { + + public PythonInterpreter interpreter; + + public JythonEnginePhantomReference(JythonScriptEngine engine, + ReferenceQueue queue) + { + super(engine, queue); + interpreter = engine.interpreter; + } + + public void cleanup() { + final List scriptLocals = new ArrayList(); + PythonInterpreter interp = interpreter; + if (interp == null) return; + + final PyObject locals = interp.getLocals(); + for (final PyObject item : locals.__iter__().asIterable()) { + final String localVar = item.toString(); + if (!localVar.contains("__name__") && !localVar.contains("__doc__")) { + + scriptLocals.add(item.toString()); + } + } + for (final String string : scriptLocals) { + interp.set(string, null); + } + } + } } From 1f8826d6472abb84cdf2177c438353455a5b96cc Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Mon, 14 Dec 2015 14:43:21 -0600 Subject: [PATCH 23/94] JythonBindings: don't store engine or module If the JythonScriptEngine or containing ScriptModule is set within the PythonInterpreter, we will get a circular reference chain preventing memory from the PythonInterpreter being reclaimed. To avoid completely discarding these objects, we can keep them in a shallow map to WeakReferences. --- .../scripting/jython/JythonBindings.java | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java index 3d6a493..1ed800e 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java @@ -31,8 +31,10 @@ package org.scijava.plugins.scripting.jython; +import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -42,6 +44,7 @@ import org.python.core.PyStringMap; import org.python.util.PythonInterpreter; +import org.scijava.script.ScriptModule; /** * A {@link Bindings} wrapper around Jython's local variables. @@ -52,6 +55,9 @@ public class JythonBindings implements Bindings { protected final PythonInterpreter interpreter; + private Map> shallowMap = + new HashMap>(); + public JythonBindings(final PythonInterpreter interpreter) { this.interpreter = interpreter; } @@ -81,6 +87,10 @@ public boolean containsValue(Object value) { @Override public Object get(Object key) { + if (shallowMap.containsKey(key)) { + return shallowMap.get(key).get(); + } + try { return interpreter.get((String)key); } catch (Error e) { @@ -91,18 +101,28 @@ public Object get(Object key) { @Override public Object put(String key, Object value) { final Object result = get(key); - try { - interpreter.set(key, value); - } catch (Error e) { - // ignore + + if (value instanceof ScriptModule || value instanceof JythonScriptEngine){ + shallowMap.put(key, new WeakReference(value)); + } + else { + try { + interpreter.set(key, value); + } + catch (Error e) { + // ignore + } } + return result; } @Override public Object remove(Object key) { final Object result = get(key); - if (result != null) interpreter.getLocals().__delitem__((String)key); + if (shallowMap.containsKey(key)) shallowMap.remove(key); + else if (result != null) interpreter.getLocals().__delitem__((String)key); + return result; } From 70e0c18c6461e784135534722e7699eaaa48cb61 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Tue, 15 Dec 2015 08:52:28 -0600 Subject: [PATCH 24/94] Document PhantomReference solution Add extensive commenting to explain why PhantomReferences are needed to solve the memory leak identified in this implementation of the Python script language. Fixes http://fiji.sc/bugzilla/show_bug.cgi?id=1203 --- .../scripting/jython/JythonBindings.java | 16 +++++++ .../jython/JythonScriptLanguage.java | 43 +++++++++++++++++-- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java index 1ed800e..146a650 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java @@ -55,6 +55,22 @@ public class JythonBindings implements Bindings { protected final PythonInterpreter interpreter; + /* + * NB: In our JythonScriptLanguage we explain the need for cleaning + * up after a PythonInterpreter and declare the scope of a + * Python environment to be equal to the lifetime of its parent + * JythonScriptEngine. + * As triggering our cleaning method involves PhantomReferences + * we must ensure that JythonScriptEngines can actually be + * garbage collected when it is no longer in use. + * To do this, we have to prevent JythonScriptEngines from + * being passed to the PythonInterpreter - which would then + * create a hard reference to the ScriptEngine through the + * static PySystemState. + * Similarly we do not want to pass ScriptModules to the + * PythonInterpreter, as the ScriptModule has a hard + * reference to its ScriptEngine. + */ private Map> shallowMap = new HashMap>(); diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index 236c4cc..4d8bde1 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -53,11 +53,16 @@ * An adapter of the Jython interpreter to the SciJava scripting interface. * * @author Johannes Schindelin + * @author Mark Hiner * @see ScriptEngine */ @Plugin(type = ScriptLanguage.class, name = "Python") public class JythonScriptLanguage extends AdaptedScriptLanguage { + // List of PhantomReferences and corresponding ReferenceQueue to + // facilitate proper PhantomReference use. + // See http://resources.ej-technologies.com/jprofiler/help/doc/index.html + private final LinkedList phantomReferences = new LinkedList(); private final ReferenceQueue queue = @@ -76,10 +81,22 @@ public ScriptEngine getScriptEngine() { final JythonScriptEngine engine = new JythonScriptEngine(); synchronized (phantomReferences) { + // NB: This phantom reference is used to clean up any local variables + // created by evaluation of scripts via this ScriptEngine. We need + // to use PhantomReferences because the "scope" of a script extends + // beyond its eval method - a consumer may still want to inspect + // the state of variables after evaluation. + // By using PhantomReferences we are saying that the scope of + // script evaluation equals the lifetime of the ScriptEngine. phantomReferences.add(new JythonEnginePhantomReference(engine, queue)); - // If we added references to an empty queue, we need to start - // a new polling thread + // NB: The use of PhantomReferences requires a paired polling thread. + // We poll instead of blocking for input to avoid leaving lingering + // threads that would need to be interrupted - instead only starting + // threads running when there is actually a PhantomReference that + // will eventually be enqueued. + // Here we check if there is already a polling thread in operation - + // if not, we start a new thread. if (phantomReferences.size() == 1) { threadService.run(new Runnable() { @@ -93,6 +110,7 @@ public void run() { Thread.sleep(100); synchronized (phantomReferences) { + // poll the queue JythonEnginePhantomReference ref = (JythonEnginePhantomReference) queue.poll(); @@ -103,7 +121,7 @@ public void run() { } // Once we're done with our known phantom refs - // we can shut down this thread. + // we can let this thread shut down done = phantomReferences.size() == 0; } @@ -135,6 +153,10 @@ public Object decode(final Object object) { return object; } + /** + * Helper class to clean up {@link PythonInterpreter} local variables when a + * parent {@link JythonScriptEngine} leaves scope. + */ private static class JythonEnginePhantomReference extends PhantomReference { @@ -153,14 +175,27 @@ public void cleanup() { PythonInterpreter interp = interpreter; if (interp == null) return; + // NB: This method for cleaning up local variables was taken from: + // http://python.6.x6.nabble.com/Cleaning-up-PythonInterpreter-object-td1777184.html + // Because Python is an interpreted language, when a Python script creates new + // variables they stick around in a static org.python.core.PySystemState variable + // (defaultSystemState) the org.python.core.Py class. + // Thus an implicit static state is created by script evaluation, so we must manually + // clean up local variables known to the interpreter when the scope of an executed + // script is over. + // See original bug report for the memory leak that prompted this solution: + // http://fiji.sc/bugzilla/show_bug.cgi?id=1203 final PyObject locals = interp.getLocals(); for (final PyObject item : locals.__iter__().asIterable()) { final String localVar = item.toString(); + // Ignore __name__ and __doc__ variables, which are special and known not + // to be local variables created by evaluation. if (!localVar.contains("__name__") && !localVar.contains("__doc__")) { - + // Build list of variables to clean scriptLocals.add(item.toString()); } } + // Null out local variables for (final String string : scriptLocals) { interp.set(string, null); } From 7647ab13f8f16074ed24dad28a659fa1ca28b991 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Tue, 15 Dec 2015 08:55:01 -0600 Subject: [PATCH 25/94] Jython polling thread: log errors Pass a LogService to the thread polling the PhantomReference queue so that exceptions can be logged. --- .../plugins/scripting/jython/JythonScriptLanguage.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index 4d8bde1..f315a9b 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -43,6 +43,7 @@ import org.python.core.PyObject; import org.python.core.PyString; import org.python.util.PythonInterpreter; +import org.scijava.log.LogService; import org.scijava.plugin.Parameter; import org.scijava.plugin.Plugin; import org.scijava.script.AdaptedScriptLanguage; @@ -71,6 +72,9 @@ public class JythonScriptLanguage extends AdaptedScriptLanguage { @Parameter private ThreadService threadService; + @Parameter + private LogService logService; + public JythonScriptLanguage() { super("jython"); } @@ -79,6 +83,7 @@ public JythonScriptLanguage() { public ScriptEngine getScriptEngine() { // TODO: Consider adapting the wrapped ScriptEngineFactory's ScriptEngine. final JythonScriptEngine engine = new JythonScriptEngine(); + final LogService ls = logService; synchronized (phantomReferences) { // NB: This phantom reference is used to clean up any local variables @@ -128,6 +133,7 @@ public void run() { } catch (final Exception ex) { // log exception, continue + ls.error(ex); } } } From dacf3e98c590d038b6d824196267884976f80c1b Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 15 Dec 2015 09:06:13 -0600 Subject: [PATCH 26/94] Move reference cleanup logic to its own class This isolates and encapsulates the cleanup logic, so the JythonScriptLanguage itself remains easy to understand. --- .../jython/JythonReferenceCleaner.java | 172 ++++++++++++++++++ .../jython/JythonScriptLanguage.java | 123 +------------ 2 files changed, 174 insertions(+), 121 deletions(-) create mode 100644 src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java new file mode 100644 index 0000000..33d4e01 --- /dev/null +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java @@ -0,0 +1,172 @@ +/* + * #%L + * JSR-223-compliant Jython scripting language plugin. + * %% + * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck + * Institute of Molecular Cell Biology and Genetics. + * %% + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * #L% + */ + +package org.scijava.plugins.scripting.jython; + +import java.lang.ref.PhantomReference; +import java.lang.ref.ReferenceQueue; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +import org.python.core.PyObject; +import org.python.util.PythonInterpreter; +import org.scijava.log.LogService; +import org.scijava.thread.ThreadService; + +/** + * A helper class for purging dangling references within a Jython interpreter + * after it executes a script. + * + * @author Mark Hiner + */ +public class JythonReferenceCleaner { + + // List of PhantomReferences and corresponding ReferenceQueue to + // facilitate proper PhantomReference use. + // See http://resources.ej-technologies.com/jprofiler/help/doc/index.html + + private final LinkedList phantomReferences = + new LinkedList(); + private final ReferenceQueue queue = + new ReferenceQueue(); + + /** Queues the future cleanup operation on a separate thread, */ + public synchronized void queueCleanup(final JythonScriptEngine engine, + final ThreadService threadService, final LogService log) + { + // NB: This phantom reference is used to clean up any local variables + // created by evaluation of scripts via this ScriptEngine. We need + // to use PhantomReferences because the "scope" of a script extends + // beyond its eval method - a consumer may still want to inspect + // the state of variables after evaluation. + // By using PhantomReferences we are saying that the scope of + // script evaluation equals the lifetime of the ScriptEngine. + phantomReferences.add(new JythonEnginePhantomReference(engine, queue)); + + // NB: The use of PhantomReferences requires a paired polling thread. + // We poll instead of blocking for input to avoid leaving lingering + // threads that would need to be interrupted - instead only starting + // threads running when there is actually a PhantomReference that + // will eventually be enqueued. + // Here we check if there is already a polling thread in operation - + // if not, we start a new thread. + if (phantomReferences.size() == 1) { + threadService.run(new Runnable() { + + @Override + public void run() { + boolean done = false; + + // poll the queue + while (!done) { + try { + Thread.sleep(100); + + synchronized (JythonReferenceCleaner.this) { + // poll the queue + JythonEnginePhantomReference ref = + (JythonEnginePhantomReference) queue.poll(); + + // if we have a ref, clean it up + if (ref != null) { + ref.cleanup(); + phantomReferences.remove(ref); + } + + // Once we're done with our known phantom refs + // we can let this thread shut down + done = phantomReferences.size() == 0; + } + + } + catch (final Exception ex) { + // log exception, continue + log.error(ex); + } + } + } + }); + } + } + + // -- Helper classes -- + + /** + * Helper class to clean up {@link PythonInterpreter} local variables when a + * parent {@link JythonScriptEngine} leaves scope. + */ + private static class JythonEnginePhantomReference extends + PhantomReference + { + + public PythonInterpreter interpreter; + + public JythonEnginePhantomReference(JythonScriptEngine engine, + ReferenceQueue queue) + { + super(engine, queue); + interpreter = engine.interpreter; + } + + public void cleanup() { + final List scriptLocals = new ArrayList(); + PythonInterpreter interp = interpreter; + if (interp == null) return; + + // NB: This method for cleaning up local variables was taken from: + // http://python.6.x6.nabble.com/Cleaning-up-PythonInterpreter-object-td1777184.html + // Because Python is an interpreted language, when a Python script creates new + // variables they stick around in a static org.python.core.PySystemState variable + // (defaultSystemState) the org.python.core.Py class. + // Thus an implicit static state is created by script evaluation, so we must manually + // clean up local variables known to the interpreter when the scope of an executed + // script is over. + // See original bug report for the memory leak that prompted this solution: + // http://fiji.sc/bugzilla/show_bug.cgi?id=1203 + final PyObject locals = interp.getLocals(); + for (final PyObject item : locals.__iter__().asIterable()) { + final String localVar = item.toString(); + // Ignore __name__ and __doc__ variables, which are special and known not + // to be local variables created by evaluation. + if (!localVar.contains("__name__") && !localVar.contains("__doc__")) { + // Build list of variables to clean + scriptLocals.add(item.toString()); + } + } + // Null out local variables + for (final String string : scriptLocals) { + interp.set(string, null); + } + } + } + +} diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index f315a9b..5912d02 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -31,18 +31,11 @@ package org.scijava.plugins.scripting.jython; -import java.lang.ref.PhantomReference; -import java.lang.ref.ReferenceQueue; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - import javax.script.ScriptEngine; import org.python.core.PyNone; import org.python.core.PyObject; import org.python.core.PyString; -import org.python.util.PythonInterpreter; import org.scijava.log.LogService; import org.scijava.plugin.Parameter; import org.scijava.plugin.Plugin; @@ -60,14 +53,7 @@ @Plugin(type = ScriptLanguage.class, name = "Python") public class JythonScriptLanguage extends AdaptedScriptLanguage { - // List of PhantomReferences and corresponding ReferenceQueue to - // facilitate proper PhantomReference use. - // See http://resources.ej-technologies.com/jprofiler/help/doc/index.html - - private final LinkedList phantomReferences = - new LinkedList(); - private final ReferenceQueue queue = - new ReferenceQueue(); + private JythonReferenceCleaner cleaner = new JythonReferenceCleaner(); @Parameter private ThreadService threadService; @@ -83,64 +69,7 @@ public JythonScriptLanguage() { public ScriptEngine getScriptEngine() { // TODO: Consider adapting the wrapped ScriptEngineFactory's ScriptEngine. final JythonScriptEngine engine = new JythonScriptEngine(); - final LogService ls = logService; - - synchronized (phantomReferences) { - // NB: This phantom reference is used to clean up any local variables - // created by evaluation of scripts via this ScriptEngine. We need - // to use PhantomReferences because the "scope" of a script extends - // beyond its eval method - a consumer may still want to inspect - // the state of variables after evaluation. - // By using PhantomReferences we are saying that the scope of - // script evaluation equals the lifetime of the ScriptEngine. - phantomReferences.add(new JythonEnginePhantomReference(engine, queue)); - - // NB: The use of PhantomReferences requires a paired polling thread. - // We poll instead of blocking for input to avoid leaving lingering - // threads that would need to be interrupted - instead only starting - // threads running when there is actually a PhantomReference that - // will eventually be enqueued. - // Here we check if there is already a polling thread in operation - - // if not, we start a new thread. - if (phantomReferences.size() == 1) { - threadService.run(new Runnable() { - - @Override - public void run() { - boolean done = false; - - // poll the queue - while (!done) { - try { - Thread.sleep(100); - - synchronized (phantomReferences) { - // poll the queue - JythonEnginePhantomReference ref = - (JythonEnginePhantomReference) queue.poll(); - - // if we have a ref, clean it up - if (ref != null) { - ref.cleanup(); - phantomReferences.remove(ref); - } - - // Once we're done with our known phantom refs - // we can let this thread shut down - done = phantomReferences.size() == 0; - } - - } - catch (final Exception ex) { - // log exception, continue - ls.error(ex); - } - } - } - }); - - } - } + cleaner.queueCleanup(engine, threadService, logService); return engine; } @@ -159,52 +88,4 @@ public Object decode(final Object object) { return object; } - /** - * Helper class to clean up {@link PythonInterpreter} local variables when a - * parent {@link JythonScriptEngine} leaves scope. - */ - private static class JythonEnginePhantomReference extends - PhantomReference - { - - public PythonInterpreter interpreter; - - public JythonEnginePhantomReference(JythonScriptEngine engine, - ReferenceQueue queue) - { - super(engine, queue); - interpreter = engine.interpreter; - } - - public void cleanup() { - final List scriptLocals = new ArrayList(); - PythonInterpreter interp = interpreter; - if (interp == null) return; - - // NB: This method for cleaning up local variables was taken from: - // http://python.6.x6.nabble.com/Cleaning-up-PythonInterpreter-object-td1777184.html - // Because Python is an interpreted language, when a Python script creates new - // variables they stick around in a static org.python.core.PySystemState variable - // (defaultSystemState) the org.python.core.Py class. - // Thus an implicit static state is created by script evaluation, so we must manually - // clean up local variables known to the interpreter when the scope of an executed - // script is over. - // See original bug report for the memory leak that prompted this solution: - // http://fiji.sc/bugzilla/show_bug.cgi?id=1203 - final PyObject locals = interp.getLocals(); - for (final PyObject item : locals.__iter__().asIterable()) { - final String localVar = item.toString(); - // Ignore __name__ and __doc__ variables, which are special and known not - // to be local variables created by evaluation. - if (!localVar.contains("__name__") && !localVar.contains("__doc__")) { - // Build list of variables to clean - scriptLocals.add(item.toString()); - } - } - // Null out local variables - for (final String string : scriptLocals) { - interp.set(string, null); - } - } - } } From 378be657e4919be97a687b00b9fd6698aa106de5 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 15 Dec 2015 09:09:10 -0600 Subject: [PATCH 27/94] JythonReferenceCleaner: reformat comments This avoids them breaking the 80 character line limit, and makes them a little nicer to read (IMHO). --- .../jython/JythonReferenceCleaner.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java index 33d4e01..2f74836 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java @@ -68,7 +68,8 @@ public synchronized void queueCleanup(final JythonScriptEngine engine, // to use PhantomReferences because the "scope" of a script extends // beyond its eval method - a consumer may still want to inspect // the state of variables after evaluation. - // By using PhantomReferences we are saying that the scope of + // + // By using PhantomReferences we are saying that the scope of // script evaluation equals the lifetime of the ScriptEngine. phantomReferences.add(new JythonEnginePhantomReference(engine, queue)); @@ -77,6 +78,7 @@ public synchronized void queueCleanup(final JythonScriptEngine engine, // threads that would need to be interrupted - instead only starting // threads running when there is actually a PhantomReference that // will eventually be enqueued. + // // Here we check if there is already a polling thread in operation - // if not, we start a new thread. if (phantomReferences.size() == 1) { @@ -144,19 +146,24 @@ public void cleanup() { // NB: This method for cleaning up local variables was taken from: // http://python.6.x6.nabble.com/Cleaning-up-PythonInterpreter-object-td1777184.html - // Because Python is an interpreted language, when a Python script creates new - // variables they stick around in a static org.python.core.PySystemState variable - // (defaultSystemState) the org.python.core.Py class. - // Thus an implicit static state is created by script evaluation, so we must manually - // clean up local variables known to the interpreter when the scope of an executed - // script is over. - // See original bug report for the memory leak that prompted this solution: + // + // Because Python is an interpreted language, when a Python script + // creates new variables they stick around in a static + // org.python.core.PySystemState variable (defaultSystemState) + // the org.python.core.Py class. + // + // Thus an implicit static state is created by script evaluation, + // so we must manually clean up local variables known to the + // interpreter when the scope of an executed script is over. + // + // See original bug report for the leak that prompted this solution: // http://fiji.sc/bugzilla/show_bug.cgi?id=1203 + final PyObject locals = interp.getLocals(); for (final PyObject item : locals.__iter__().asIterable()) { final String localVar = item.toString(); - // Ignore __name__ and __doc__ variables, which are special and known not - // to be local variables created by evaluation. + // Ignore __name__ and __doc__ variables, which are special + // and known not to be local variables created by evaluation. if (!localVar.contains("__name__") && !localVar.contains("__doc__")) { // Build list of variables to clean scriptLocals.add(item.toString()); From 98fa04174681d7d74dd50ebe0ad4ecb04a3984cb Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 15 Dec 2015 09:10:49 -0600 Subject: [PATCH 28/94] JythonReferenceCleaner: add missing final keywords --- .../scripting/jython/JythonReferenceCleaner.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java index 2f74836..f73a721 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java @@ -95,8 +95,8 @@ public void run() { synchronized (JythonReferenceCleaner.this) { // poll the queue - JythonEnginePhantomReference ref = - (JythonEnginePhantomReference) queue.poll(); + final JythonEnginePhantomReference ref = + (JythonEnginePhantomReference) queue.poll(); // if we have a ref, clean it up if (ref != null) { @@ -132,8 +132,8 @@ private static class JythonEnginePhantomReference extends public PythonInterpreter interpreter; - public JythonEnginePhantomReference(JythonScriptEngine engine, - ReferenceQueue queue) + public JythonEnginePhantomReference(final JythonScriptEngine engine, + final ReferenceQueue queue) { super(engine, queue); interpreter = engine.interpreter; @@ -141,7 +141,7 @@ public JythonEnginePhantomReference(JythonScriptEngine engine, public void cleanup() { final List scriptLocals = new ArrayList(); - PythonInterpreter interp = interpreter; + final PythonInterpreter interp = interpreter; if (interp == null) return; // NB: This method for cleaning up local variables was taken from: From ec94659d3265464b5e450905a94f03fe19a1e077 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 15 Dec 2015 11:49:12 -0600 Subject: [PATCH 29/94] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f43bee2..9350039 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.2.4-SNAPSHOT + 0.2.5-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From 9cfbec264b4041218e5763ad8b27293551d01f0c Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 21 Jan 2016 14:37:20 +0100 Subject: [PATCH 30/94] Recategorize script templates by functionality See also: imagej/imagej-ui-swing@cbe052a01505370a27f87aef26c0c48eea178d21 --- src/main/resources/script_templates/{Python => Intro}/Greeting.py | 0 .../resources/script_templates/{Python => Intro}/Hello_World.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/script_templates/{Python => Intro}/Greeting.py (100%) rename src/main/resources/script_templates/{Python => Intro}/Hello_World.py (100%) diff --git a/src/main/resources/script_templates/Python/Greeting.py b/src/main/resources/script_templates/Intro/Greeting.py similarity index 100% rename from src/main/resources/script_templates/Python/Greeting.py rename to src/main/resources/script_templates/Intro/Greeting.py diff --git a/src/main/resources/script_templates/Python/Hello_World.py b/src/main/resources/script_templates/Intro/Hello_World.py similarity index 100% rename from src/main/resources/script_templates/Python/Hello_World.py rename to src/main/resources/script_templates/Intro/Hello_World.py From 97c916c46e636306115b781568b30fdc6d8305b4 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Tue, 23 Feb 2016 15:10:02 -0600 Subject: [PATCH 31/94] Bump parent to pom-scijava 9.4.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9350039..635223b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 9.0.0 + 9.4.0 From 9eb25b4d0bff5592d0846fa312337a62bf1260d1 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Tue, 23 Feb 2016 15:11:17 -0600 Subject: [PATCH 32/94] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 635223b..cf10781 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.2.5-SNAPSHOT + 0.2.6-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From 63bade13510e738ba3c5bde5f327db175c12f8a0 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Tue, 1 Mar 2016 07:25:21 -0600 Subject: [PATCH 33/94] Tests use full Context Jython will require additional services to manage its cleanup, so we do not want to start a minimal context. --- .../org/scijava/plugins/scripting/jython/JythonTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java index 74ff47a..3478461 100644 --- a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java +++ b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java @@ -59,7 +59,7 @@ public class JythonTest { public void testBasic() throws InterruptedException, ExecutionException, IOException, ScriptException { - final Context context = new Context(ScriptService.class); + final Context context = new Context(); final ScriptService scriptService = context.getService(ScriptService.class); final String script = "1 + 2"; final ScriptModule m = scriptService.run("add.py", script, true).get(); @@ -70,7 +70,7 @@ public void testBasic() throws InterruptedException, ExecutionException, @Test public void testLocals() throws ScriptException { - final Context context = new Context(ScriptService.class); + final Context context = new Context(); final ScriptService scriptService = context.getService(ScriptService.class); final ScriptLanguage language = scriptService.getLanguageByExtension("py"); @@ -89,7 +89,7 @@ public void testLocals() throws ScriptException { public void testParameters() throws InterruptedException, ExecutionException, IOException, ScriptException { - final Context context = new Context(ScriptService.class); + final Context context = new Context(); final ScriptService scriptService = context.getService(ScriptService.class); final String script = "" + // @@ -128,7 +128,7 @@ public void testParameters() throws InterruptedException, ExecutionException, public void testLongType() throws InterruptedException, ExecutionException, IOException, ScriptException { - final Context context = new Context(ScriptService.class); + final Context context = new Context(); final ScriptService scriptService = context.getService(ScriptService.class); final String script = "" + // From 2885439c0b40416d279851e2be64882ad0791fe9 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Tue, 1 Mar 2016 07:26:15 -0600 Subject: [PATCH 34/94] Use JythonService to manage cleanup The JythonReferenceCleaner needs to be shut down when the Context is disposed. The JythonService provides us a dispose() hook to ensure this happens. To maintain the JythonReferenceCleaner, the JythonService must also be the gateway for creating JythonScriptEngines. --- .../jython/DefaultJythonService.java | 87 +++++++++++++++++++ .../jython/JythonReferenceCleaner.java | 8 +- .../jython/JythonScriptLanguage.java | 19 ++-- .../scripting/jython/JythonService.java | 53 +++++++++++ 4 files changed, 154 insertions(+), 13 deletions(-) create mode 100644 src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java create mode 100644 src/main/java/org/scijava/plugins/scripting/jython/JythonService.java diff --git a/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java b/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java new file mode 100644 index 0000000..be74b1d --- /dev/null +++ b/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java @@ -0,0 +1,87 @@ +/* + * #%L + * JSR-223-compliant Jython scripting language plugin. + * %% + * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck + * Institute of Molecular Cell Biology and Genetics. + * %% + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * #L% + */ +package org.scijava.plugins.scripting.jython; + +import javax.script.ScriptEngine; + +import org.scijava.log.LogService; +import org.scijava.plugin.Parameter; +import org.scijava.plugin.Plugin; +import org.scijava.service.AbstractService; +import org.scijava.service.Service; +import org.scijava.thread.ThreadService; + +/** + * Default {@link JythonService} implementation. Maintains a + * {@link JythonReferenceCleaner} instance. + * + * @author Mark Hiner hinerm at gmail.com + */ +@Plugin(type = Service.class) +public class DefaultJythonService extends AbstractService implements JythonService { + + // -- Fields -- + + private JythonReferenceCleaner cleaner; + + // -- Parameters -- + + @Parameter + private ThreadService threadService; + + @Parameter + private LogService logService; + + // -- JythonService methods -- + + @Override + public ScriptEngine getScriptEngine() { + // TODO: Consider adapting the wrapped ScriptEngineFactory's + // ScriptEngine. + final JythonScriptEngine engine = new JythonScriptEngine(); + cleaner.queueCleanup(engine, threadService, logService); + return engine; + } + + // -- Service methods -- + + @Override + public void initialize() { + cleaner = new JythonReferenceCleaner(); + } + + // -- Disposable methods -- + + @Override + public void dispose() { + cleaner.shutDown(); + } +} diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java index f73a721..02761c5 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java @@ -59,6 +59,8 @@ public class JythonReferenceCleaner { private final ReferenceQueue queue = new ReferenceQueue(); + private boolean shutDown = false; + /** Queues the future cleanup operation on a separate thread, */ public synchronized void queueCleanup(final JythonScriptEngine engine, final ThreadService threadService, final LogService log) @@ -106,7 +108,7 @@ public void run() { // Once we're done with our known phantom refs // we can let this thread shut down - done = phantomReferences.size() == 0; + done = phantomReferences.size() == 0 || shutDown; } } @@ -120,6 +122,10 @@ public void run() { } } + public void shutDown() { + shutDown = true; + } + // -- Helper classes -- /** diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index 5912d02..f718993 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -36,12 +36,11 @@ import org.python.core.PyNone; import org.python.core.PyObject; import org.python.core.PyString; -import org.scijava.log.LogService; +import org.scijava.Context; import org.scijava.plugin.Parameter; import org.scijava.plugin.Plugin; import org.scijava.script.AdaptedScriptLanguage; import org.scijava.script.ScriptLanguage; -import org.scijava.thread.ThreadService; /** * An adapter of the Jython interpreter to the SciJava scripting interface. @@ -53,13 +52,8 @@ @Plugin(type = ScriptLanguage.class, name = "Python") public class JythonScriptLanguage extends AdaptedScriptLanguage { - private JythonReferenceCleaner cleaner = new JythonReferenceCleaner(); - - @Parameter - private ThreadService threadService; - @Parameter - private LogService logService; + private Context context; public JythonScriptLanguage() { super("jython"); @@ -67,10 +61,11 @@ public JythonScriptLanguage() { @Override public ScriptEngine getScriptEngine() { - // TODO: Consider adapting the wrapped ScriptEngineFactory's ScriptEngine. - final JythonScriptEngine engine = new JythonScriptEngine(); - cleaner.queueCleanup(engine, threadService, logService); - return engine; + // NB: recursive priorities can only be resolved via inter-service + // dependencies. There is no way to make the ScriptService + // depend on the JythonService because of the hierarchy + // of components. So we have to get the JythonService indirectly. + return context.service(JythonService.class).getScriptEngine(); } @Override diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java new file mode 100644 index 0000000..2d4f2b0 --- /dev/null +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java @@ -0,0 +1,53 @@ +/* + * #%L + * JSR-223-compliant Jython scripting language plugin. + * %% + * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck + * Institute of Molecular Cell Biology and Genetics. + * %% + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * #L% + */ +package org.scijava.plugins.scripting.jython; + +import javax.script.ScriptEngine; + +import org.scijava.service.SciJavaService; +import org.scijava.service.Service; + +/** + * {@link Service} for managing contextual Jython metadata. + *

+ * The {@link #getScriptEngine()} method should be used to access + * {@link JythonScriptEngine} instances, to ensure they are cleaned properly. + *

+ * + * @author Mark Hiner hinerm at gmail.com + */ +public interface JythonService extends SciJavaService { + + /** + * @return Get a Jython {@link ScriptEngine} instance. + */ + ScriptEngine getScriptEngine(); +} From 1f82871d459b80ed5df14a926bc2d741f3467d10 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Wed, 2 Mar 2016 10:15:26 -0600 Subject: [PATCH 35/94] Bump parent to pom-scijava 9.6.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cf10781..fb3ad49 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 9.4.0 + 9.6.0 From 8ffe4dc2ed2d0e7fcd86e56768d4df379de416b1 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Wed, 2 Mar 2016 14:30:39 -0600 Subject: [PATCH 36/94] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fb3ad49..eedc0e9 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.2.6-SNAPSHOT + 0.3.1-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From 08863d5cf3925046f05dc4825cb472ec6064628a Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 4 May 2016 13:50:30 -0500 Subject: [PATCH 37/94] Use imagej.net URL for all developers And remove the superfluous (and prone to obsolescence) other info. --- pom.xml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index eedc0e9..dc3fcaa 100644 --- a/pom.xml +++ b/pom.xml @@ -27,10 +27,7 @@ ctrueden Curtis Rueden - ctrueden@wisc.edu - http://loci.wisc.edu/people/curtis-rueden - UW-Madison LOCI - http://loci.wisc.edu/ + http://imagej.net/User:Rueden lead developer @@ -39,15 +36,11 @@ support maintainer - -6 hinerm Mark Hiner - hiner@wisc.edu - http://loci.wisc.edu/people/mark-hiner - UW-Madison LOCI - http://loci.wisc.edu/ + http://imagej.net/User:Hinerm lead developer @@ -56,7 +49,6 @@ support maintainer - -6 From 454c6631591077a325009f10cd49ac226487c6ec Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 9 Jun 2016 16:57:09 -0500 Subject: [PATCH 38/94] POM: goodbye Mark! --- pom.xml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index dc3fcaa..66a4f19 100644 --- a/pom.xml +++ b/pom.xml @@ -37,19 +37,6 @@ maintainer - - hinerm - Mark Hiner - http://imagej.net/User:Hinerm - - lead - developer - debugger - reviewer - support - maintainer - - @@ -58,6 +45,11 @@ founder dscho + + Mark Hiner + http://imagej.net/User:Hinerm + hinerm + From e1caf30d1e8bc653be6a13a98dfddc99f2a5b2c5 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 30 Aug 2016 10:25:33 -0500 Subject: [PATCH 39/94] JythonScriptLanguage: decode more PyObject types It seems that for PyInteger at least, even though it is a PyObject, the approach of calling __tojava__(getType().getProxyType()) does not work. So to be safe, let's hardcode the types we _know_ we can support -- PyBoolean, PyInteger, PyFloat and PyString -- before PyObject generally. Hopefully, this will prevent warnings such as: [WARNING] Ignoring unsupported output: result [org.python.core.PyInteger] This change also updates the JythonTest#testBasic() method, since the result is now an Integer rather than a PyInteger. --- .../scripting/jython/JythonScriptLanguage.java | 18 +++++++++++++++--- .../plugins/scripting/jython/JythonTest.java | 5 +++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index f718993..38bc4cb 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -33,6 +33,9 @@ import javax.script.ScriptEngine; +import org.python.core.PyBoolean; +import org.python.core.PyFloat; +import org.python.core.PyInteger; import org.python.core.PyNone; import org.python.core.PyObject; import org.python.core.PyString; @@ -71,15 +74,24 @@ public ScriptEngine getScriptEngine() { @Override public Object decode(final Object object) { if (object instanceof PyNone) return null; + if (object instanceof PyBoolean) { + return ((PyBoolean) object).getBooleanValue(); + } + if (object instanceof PyInteger) { + return ((PyInteger) object).getValue(); + } + if (object instanceof PyFloat) { + return ((PyFloat) object).getValue(); + } + if (object instanceof PyString) { + return ((PyString) object).getString(); + } if (object instanceof PyObject) { // Unwrap Python objects when they wrap Java ones. final PyObject pyObj = (PyObject) object; final Class javaType = pyObj.getType().getProxyType(); if (javaType != null) return pyObj.__tojava__(javaType); } - if (object instanceof PyString) { - return ((PyString) object).getString(); - } return object; } diff --git a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java index 3478461..e6d546c 100644 --- a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java +++ b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java @@ -33,6 +33,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; import java.io.IOException; import java.util.concurrent.ExecutionException; @@ -64,8 +65,8 @@ public void testBasic() throws InterruptedException, ExecutionException, final String script = "1 + 2"; final ScriptModule m = scriptService.run("add.py", script, true).get(); final Object result = m.getReturnValue(); - // NB: Result is of type org.python.core.PyInteger. - assertEquals("3", result.toString()); + assertSame(Integer.class, result.getClass()); + assertEquals(3, result); } @Test From 64edfb454ea16d892a28fed7a22e518dd180778b Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 2 Sep 2016 10:58:16 -0500 Subject: [PATCH 40/94] Happy New Year 2016 --- LICENSE.txt | 2 +- .../plugins/scripting/jython/DefaultJythonService.java | 4 ++-- .../org/scijava/plugins/scripting/jython/JythonBindings.java | 2 +- .../plugins/scripting/jython/JythonReferenceCleaner.java | 2 +- .../scijava/plugins/scripting/jython/JythonScriptEngine.java | 2 +- .../plugins/scripting/jython/JythonScriptLanguage.java | 2 +- .../org/scijava/plugins/scripting/jython/JythonService.java | 4 ++-- .../java/org/scijava/plugins/scripting/jython/JythonTest.java | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index cce13af..886feee 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2008 - 2015, Board of Regents of the University of +Copyright (c) 2008 - 2016, Board of Regents of the University of Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. All rights reserved. diff --git a/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java b/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java index be74b1d..b76fd04 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java @@ -8,13 +8,13 @@ * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java index 146a650..00d1b76 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java index 02761c5..c3fead1 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java index bd710b8..7adcc16 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index 38bc4cb..5f75d48 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java index 2d4f2b0..d0b5cf6 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java @@ -8,13 +8,13 @@ * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java index e6d546c..ccad6c5 100644 --- a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java +++ b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% From a2a5716a487bd2e09c21c6df26b1c00b82c4423d Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 2 Sep 2016 08:19:07 -0500 Subject: [PATCH 41/94] POM: bump pom-scijava parent to 11.2.1 Aside from the usual managed component version updates, this reduces boilerplate for the maven-jar-plugin and license-maven-plugin. --- pom.xml | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index 66a4f19..a3f1987 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 9.6.0 + 11.2.1 @@ -23,6 +23,15 @@ + + org.scijava.plugins.scripting.jython + + bsd_2 + Board of Regents of the University of +Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck +Institute of Molecular Cell Biology and Genetics. + + ctrueden @@ -88,29 +97,4 @@ test - - - - - maven-jar-plugin - - - - org.scijava.plugins.scripting.jython - - - - - - org.codehaus.mojo - license-maven-plugin - - bsd_2 - Board of Regents of the University of -Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck -Institute of Molecular Cell Biology and Genetics. - - - - From 629214775ce973c67c3308a994829002aac1ee3b Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 2 Sep 2016 11:20:40 -0500 Subject: [PATCH 42/94] JythonTest: decode variables before checking them I could have sworn that I tested this, but apparently not. It turns out that return values are not decoded by default. So for the time being, let's just do it in the test here. (Ultimately, we probably want to decode them automatically.) Values extracted directly from the bindings are also not decoded, so let's decode those manually as well. (That should probably also be automatic, though I'm not sure.) --- .../org/scijava/plugins/scripting/jython/JythonTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java index ccad6c5..e141aa2 100644 --- a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java +++ b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java @@ -64,7 +64,7 @@ public void testBasic() throws InterruptedException, ExecutionException, final ScriptService scriptService = context.getService(ScriptService.class); final String script = "1 + 2"; final ScriptModule m = scriptService.run("add.py", script, true).get(); - final Object result = m.getReturnValue(); + final Object result = m.getLanguage().decode(m.getReturnValue()); assertSame(Integer.class, result.getClass()); assertEquals(3, result); } @@ -78,8 +78,8 @@ public void testLocals() throws ScriptException { final ScriptEngine engine = language.getScriptEngine(); assertEquals(JythonScriptEngine.class, engine.getClass()); engine.put("hello", 17); - assertEquals("17", engine.eval("hello").toString()); - assertEquals("17", engine.get("hello").toString()); + assertEquals(17, language.decode(engine.eval("hello"))); + assertEquals(17, language.decode(engine.get("hello"))); final Bindings bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE); bindings.clear(); From 78a3c6c4c2f3637cb08b5e67857b993d8e7dfd97 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 2 Sep 2016 11:24:21 -0500 Subject: [PATCH 43/94] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a3f1987..65bc93e 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.3.1-SNAPSHOT + 0.3.2-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From b3a983f2e78ab66cbada6059db7a675899aaa700 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 2 Sep 2016 13:02:12 -0500 Subject: [PATCH 44/94] Clean up style --- .../jython/DefaultJythonService.java | 9 ++- .../scripting/jython/JythonBindings.java | 59 ++++++++++--------- .../jython/JythonReferenceCleaner.java | 12 ++-- .../scripting/jython/JythonScriptEngine.java | 14 ++--- .../jython/JythonScriptLanguage.java | 12 ++-- .../scripting/jython/JythonService.java | 5 +- .../plugins/scripting/jython/JythonTest.java | 8 +-- 7 files changed, 64 insertions(+), 55 deletions(-) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java b/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java index b76fd04..514ff46 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java @@ -8,13 +8,13 @@ * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -28,6 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. * #L% */ + package org.scijava.plugins.scripting.jython; import javax.script.ScriptEngine; @@ -46,7 +47,9 @@ * @author Mark Hiner hinerm at gmail.com */ @Plugin(type = Service.class) -public class DefaultJythonService extends AbstractService implements JythonService { +public class DefaultJythonService extends AbstractService implements + JythonService +{ // -- Fields -- diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java index 00d1b76..e01312f 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java @@ -8,13 +8,13 @@ * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -48,7 +48,7 @@ /** * A {@link Bindings} wrapper around Jython's local variables. - * + * * @author Johannes Schindelin */ public class JythonBindings implements Bindings { @@ -71,8 +71,7 @@ public class JythonBindings implements Bindings { * PythonInterpreter, as the ScriptModule has a hard * reference to its ScriptEngine. */ - private Map> shallowMap = - new HashMap>(); + private final Map> shallowMap = new HashMap<>(); public JythonBindings(final PythonInterpreter interpreter) { this.interpreter = interpreter; @@ -89,12 +88,12 @@ public boolean isEmpty() { } @Override - public boolean containsKey(Object key) { + public boolean containsKey(final Object key) { return get(key) != null; } @Override - public boolean containsValue(Object value) { + public boolean containsValue(final Object value) { for (final Object value2 : values()) { if (value.equals(value2)) return true; } @@ -102,30 +101,31 @@ public boolean containsValue(Object value) { } @Override - public Object get(Object key) { + public Object get(final Object key) { if (shallowMap.containsKey(key)) { return shallowMap.get(key).get(); } try { - return interpreter.get((String)key); - } catch (Error e) { + return interpreter.get((String) key); + } + catch (final Error e) { return null; } } @Override - public Object put(String key, Object value) { + public Object put(final String key, final Object value) { final Object result = get(key); - if (value instanceof ScriptModule || value instanceof JythonScriptEngine){ - shallowMap.put(key, new WeakReference(value)); + if (value instanceof ScriptModule || value instanceof JythonScriptEngine) { + shallowMap.put(key, new WeakReference<>(value)); } else { try { interpreter.set(key, value); } - catch (Error e) { + catch (final Error e) { // ignore } } @@ -134,23 +134,25 @@ public Object put(String key, Object value) { } @Override - public Object remove(Object key) { + public Object remove(final Object key) { final Object result = get(key); if (shallowMap.containsKey(key)) shallowMap.remove(key); - else if (result != null) interpreter.getLocals().__delitem__((String)key); + else if (result != null) interpreter.getLocals().__delitem__((String) key); return result; } @Override - public void putAll(Map toMerge) { - for (final Entry entry : toMerge.entrySet()) { + public void putAll(final Map toMerge) { + for (final Entry entry : toMerge + .entrySet()) + { put(entry.getKey(), entry.getValue()); } } private PyStringMap dict() { - return (PyStringMap)interpreter.getLocals(); + return (PyStringMap) interpreter.getLocals(); } @Override @@ -160,7 +162,7 @@ public void clear() { @Override public Set keySet() { - final Set result = new HashSet(); + final Set result = new HashSet<>(); for (final Object name : dict().keys()) { result.add(name.toString()); } @@ -169,18 +171,21 @@ public Set keySet() { @Override public Collection values() { - final List result = new ArrayList(); - for (final Object name : dict().keys()) try { - result.add(get(name)); - } catch (Error exc) { - // ignore for now + final List result = new ArrayList<>(); + for (final Object name : dict().keys()) { + try { + result.add(get(name)); + } + catch (final Error exc) { + // ignore for now + } } return result; } @Override public Set> entrySet() { - final Set> result = new HashSet>(); + final Set> result = new HashSet<>(); for (final Object name : dict().keys()) { result.add(new Entry() { @@ -195,7 +200,7 @@ public Object getValue() { } @Override - public Object setValue(Object value) { + public Object setValue(final Object value) { throw new UnsupportedOperationException(); } }); diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java index c3fead1..bb4de91 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java @@ -8,13 +8,13 @@ * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -45,7 +45,7 @@ /** * A helper class for purging dangling references within a Jython interpreter * after it executes a script. - * + * * @author Mark Hiner */ public class JythonReferenceCleaner { @@ -55,9 +55,9 @@ public class JythonReferenceCleaner { // See http://resources.ej-technologies.com/jprofiler/help/doc/index.html private final LinkedList phantomReferences = - new LinkedList(); + new LinkedList<>(); private final ReferenceQueue queue = - new ReferenceQueue(); + new ReferenceQueue<>(); private boolean shutDown = false; @@ -146,7 +146,7 @@ public JythonEnginePhantomReference(final JythonScriptEngine engine, } public void cleanup() { - final List scriptLocals = new ArrayList(); + final List scriptLocals = new ArrayList<>(); final PythonInterpreter interp = interpreter; if (interp == null) return; diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java index 7adcc16..7a9e742 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java @@ -8,13 +8,13 @@ * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -44,11 +44,10 @@ /** * A Python interpreter based on Jython. - * + * * @author Johannes Schindelin */ -public class JythonScriptEngine extends AbstractScriptEngine -{ +public class JythonScriptEngine extends AbstractScriptEngine { protected final PythonInterpreter interpreter; @@ -73,7 +72,8 @@ public Object eval(final Reader reader) throws ScriptException { setup(); try { final String filename = getString(ScriptEngine.FILENAME); - return Py.runCode(interpreter.compile(reader, filename), null, interpreter.getLocals()); + return Py.runCode(interpreter.compile(reader, filename), null, interpreter + .getLocals()); } catch (final Exception e) { throw new ScriptException(e); @@ -97,7 +97,7 @@ protected void setup() { } private String getString(final String key) { - Object result = get(key); + final Object result = get(key); return result == null ? null : result.toString(); } } diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index 5f75d48..375517f 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -8,13 +8,13 @@ * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -47,7 +47,7 @@ /** * An adapter of the Jython interpreter to the SciJava scripting interface. - * + * * @author Johannes Schindelin * @author Mark Hiner * @see ScriptEngine @@ -65,9 +65,9 @@ public JythonScriptLanguage() { @Override public ScriptEngine getScriptEngine() { // NB: recursive priorities can only be resolved via inter-service - // dependencies. There is no way to make the ScriptService - // depend on the JythonService because of the hierarchy - // of components. So we have to get the JythonService indirectly. + // dependencies. There is no way to make the ScriptService + // depend on the JythonService because of the hierarchy + // of components. So we have to get the JythonService indirectly. return context.service(JythonService.class).getScriptEngine(); } diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java index d0b5cf6..5ae600f 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java @@ -8,13 +8,13 @@ * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -28,6 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. * #L% */ + package org.scijava.plugins.scripting.jython; import javax.script.ScriptEngine; diff --git a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java index e141aa2..10dc735 100644 --- a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java +++ b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java @@ -8,13 +8,13 @@ * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -51,7 +51,7 @@ /** * Jython unit tests. - * + * * @author Johannes Schindelin */ public class JythonTest { @@ -100,7 +100,7 @@ public void testParameters() throws InterruptedException, ExecutionException, final ScriptModule m = scriptService.run("hello.py", script, true).get(); final Object actual = m.getOutput("language"); - final String expected = + final String expected = // scriptService.getLanguageByName("jython").getLanguageName(); assertEquals(expected, actual); } From ea2009c44edba4a3373b226683971186f158c9d5 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 16 Sep 2016 12:29:03 -0500 Subject: [PATCH 45/94] POM: factor out the jython version to a property --- pom.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 65bc93e..8582b15 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,9 @@ Board of Regents of the University of Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. + + 2.5.3 + ${jython.version} @@ -87,7 +90,7 @@ Institute of Molecular Cell Biology and Genetics. org.scijava jython-shaded - 2.5.3 + ${jython-shaded.version} From 2bdc2ab4b045719e327537762935a795cb78790c Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 16 Sep 2016 12:29:22 -0500 Subject: [PATCH 46/94] Update to Jython 2.7.0 Finally! Due to the magnitude of this change under the hood, we bump the scripting-jython version to 0.4.0-SNAPSHOT. --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8582b15..04ab456 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.3.2-SNAPSHOT + 0.4.0-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. @@ -31,7 +31,7 @@ Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. - 2.5.3 + 2.7.0 ${jython.version} From 011f0e53a393b2b0d1f564b00482b5310c2d51d4 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 16 Sep 2016 12:44:01 -0500 Subject: [PATCH 47/94] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 04ab456..bb0a582 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From f201a7f3469a118e1ae5e660024c4bffe982df20 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 1 Jan 2017 20:47:18 -0600 Subject: [PATCH 48/94] POM: tidy up Accomplished using: mvn tidy:pom --- pom.xml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index bb0a582..290d11f 100644 --- a/pom.xml +++ b/pom.xml @@ -23,18 +23,6 @@ - - org.scijava.plugins.scripting.jython - - bsd_2 - Board of Regents of the University of -Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck -Institute of Molecular Cell Biology and Genetics. - - 2.7.0 - ${jython.version} - - ctrueden @@ -79,6 +67,18 @@ Institute of Molecular Cell Biology and Genetics. http://jenkins.imagej.net/job/scripting-Jython/ + + org.scijava.plugins.scripting.jython + + bsd_2 + Board of Regents of the University of +Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck +Institute of Molecular Cell Biology and Genetics. + + 2.7.0 + ${jython.version} + + From 457a6e2e0f234338991b21dd24d0a17db8fc8078 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 1 Jan 2017 20:47:37 -0600 Subject: [PATCH 49/94] Update parent to org.scijava:pom-scijava:12.0.0 See: http://forum.imagej.net/t/split-boms-from-parent-configuration/2563 --- pom.xml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 290d11f..36c1354 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 11.2.1 + 12.0.0 @@ -16,6 +16,10 @@ JSR-223-compliant Jython scripting language plugin. http://scijava.org/ 2008 + + SciJava + http://scijava.org/ + Simplified BSD License @@ -52,6 +56,16 @@ + + + SciJava + https://groups.google.com/group/scijava + https://groups.google.com/group/scijava + scijava.com + https://groups.google.com/group/scijava + + + scm:git:git://github.com/scijava/scripting-jython scm:git:git@github.com:scijava/scripting-jython From bc7535963f31af05ca5b81afa91a186919b9d5c2 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 1 Jan 2017 20:47:40 -0600 Subject: [PATCH 50/94] Happy New Year 2017 --- LICENSE.txt | 2 +- .../plugins/scripting/jython/DefaultJythonService.java | 6 +++--- .../scijava/plugins/scripting/jython/JythonBindings.java | 6 +++--- .../plugins/scripting/jython/JythonReferenceCleaner.java | 6 +++--- .../plugins/scripting/jython/JythonScriptEngine.java | 6 +++--- .../plugins/scripting/jython/JythonScriptLanguage.java | 6 +++--- .../org/scijava/plugins/scripting/jython/JythonService.java | 6 +++--- .../org/scijava/plugins/scripting/jython/JythonTest.java | 6 +++--- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 886feee..28fb714 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2008 - 2016, Board of Regents of the University of +Copyright (c) 2008 - 2017, Board of Regents of the University of Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. All rights reserved. diff --git a/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java b/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java index 514ff46..62465a8 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java @@ -2,19 +2,19 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Copyright (C) 2008 - 2017 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java index e01312f..cef01ce 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java @@ -2,19 +2,19 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Copyright (C) 2008 - 2017 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java index bb4de91..c5ff8fc 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java @@ -2,19 +2,19 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Copyright (C) 2008 - 2017 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java index 7a9e742..dceb5c1 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java @@ -2,19 +2,19 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Copyright (C) 2008 - 2017 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index 375517f..4ba51d5 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -2,19 +2,19 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Copyright (C) 2008 - 2017 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java index 5ae600f..d3ae506 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java @@ -2,19 +2,19 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Copyright (C) 2008 - 2017 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java index 10dc735..810f7bb 100644 --- a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java +++ b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java @@ -2,19 +2,19 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Copyright (C) 2008 - 2017 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE From c3267b6b378efd33daba3f0f30a5ebbacffa8f1a Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 14 Mar 2017 13:17:58 -0500 Subject: [PATCH 51/94] POM: fix mailing list post address --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 36c1354..12685cb 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ SciJava https://groups.google.com/group/scijava https://groups.google.com/group/scijava - scijava.com + scijava@googlegroups.com https://groups.google.com/group/scijava From c6f9b0593a955c29e99d7e80db21b454c906a1ee Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 28 Feb 2017 08:18:19 -0600 Subject: [PATCH 52/94] Switch from Jenkins to Travis CI --- .travis.yml | 12 ++++++++++++ .travis/build.sh | 7 +++++++ .travis/notify.sh | 2 ++ .travis/settings.xml | 14 ++++++++++++++ README.md | 2 +- pom.xml | 4 ++-- 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 .travis.yml create mode 100755 .travis/build.sh create mode 100755 .travis/notify.sh create mode 100644 .travis/settings.xml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2fd67bc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: java +jdk: oraclejdk8 +branches: + only: master +install: true +script: ".travis/build.sh" +after_success: ".travis/notify.sh Travis-Success" +after_failure: ".travis/notify.sh Travis-Failure" +env: + global: + - secure: JVq9EcQTLbGZTBWil2z/WKd84I2YsHQyIlhU6OmKSYIi4CZDb+4cl5rwLOlLeM+jlkX9eYHRfIRgscdAR1fBHFn+piXYjtsIsE3kHSnGSTmZklEk8VGsY5j0Y7FwZJj7CYrvEfAunYR5ivIpbESDzejjLPQVsMyq3EzrQ+FTM7o= + - secure: GcG0+iBIi85qlcM0WrskXZVxVXsvRGeRMiNDuMWHVQ3skVV6kEtcqAgjTzMDllOwvsgHED3zoMRXFIjvhKPOQXtq6w55s6IVM2ytLjT1cJ6rVn8wzmHKCJUgQwQRa7CJvQcfAzess+teKhSFoGShGFiacaPHVfygtSgeZ0InJC0= diff --git a/.travis/build.sh b/.travis/build.sh new file mode 100755 index 0000000..4c2f8d2 --- /dev/null +++ b/.travis/build.sh @@ -0,0 +1,7 @@ +#!/bin/sh +dir="$(dirname "$0")" +test "$TRAVIS_SECURE_ENV_VARS" = true \ + -a "$TRAVIS_PULL_REQUEST" = false \ + -a "$TRAVIS_BRANCH" = master && + mvn -Pdeploy-to-imagej deploy --settings "$dir/settings.xml" || + mvn install diff --git a/.travis/notify.sh b/.travis/notify.sh new file mode 100755 index 0000000..b3b239e --- /dev/null +++ b/.travis/notify.sh @@ -0,0 +1,2 @@ +#!/bin/sh +curl -fs "https://jenkins.imagej.net/job/$1/buildWithParameters?token=$TOKEN_NAME&repo=$TRAVIS_REPO_SLUG&commit=$TRAVIS_COMMIT&pr=$TRAVIS_PULL_REQUEST" diff --git a/.travis/settings.xml b/.travis/settings.xml new file mode 100644 index 0000000..71a5630 --- /dev/null +++ b/.travis/settings.xml @@ -0,0 +1,14 @@ + + + + imagej.releases + travis + ${env.MAVEN_PASS} + + + imagej.snapshots + travis + ${env.MAVEN_PASS} + + + diff --git a/README.md b/README.md index d9a2943..807843a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![](http://jenkins.imagej.net/job/scripting-Jython/lastBuild/badge/icon)](http://jenkins.imagej.net/job/scripting-Jython/) +[![](https://travis-ci.org/scijava/scripting-jython.svg?branch=master)](https://travis-ci.org/scijava/scripting-jython) # Jython Scripting diff --git a/pom.xml b/pom.xml index 12685cb..2f836cc 100644 --- a/pom.xml +++ b/pom.xml @@ -77,8 +77,8 @@ https://github.com/scijava/scripting-jython/issues - Jenkins - http://jenkins.imagej.net/job/scripting-Jython/ + Travis CI + https://travis-ci.org/scijava/scripting-jython From e1b6a612ce28bdbeea1fe9a9f2ab0336e631bcf8 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sat, 18 Feb 2017 09:48:57 +0000 Subject: [PATCH 53/94] JythonTest: clean up contexts properly --- .../plugins/scripting/jython/JythonTest.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java index 810f7bb..58a3456 100644 --- a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java +++ b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java @@ -43,6 +43,8 @@ import javax.script.ScriptEngine; import javax.script.ScriptException; +import org.junit.After; +import org.junit.Before; import org.junit.Test; import org.scijava.Context; import org.scijava.script.ScriptLanguage; @@ -56,12 +58,24 @@ */ public class JythonTest { + private Context context; + private ScriptService scriptService; + + @Before + public void setUp() { + context = new Context(); + scriptService = context.getService(ScriptService.class); + } + + @After + public void tearDown() { + context.dispose(); + } + @Test public void testBasic() throws InterruptedException, ExecutionException, IOException, ScriptException { - final Context context = new Context(); - final ScriptService scriptService = context.getService(ScriptService.class); final String script = "1 + 2"; final ScriptModule m = scriptService.run("add.py", script, true).get(); final Object result = m.getLanguage().decode(m.getReturnValue()); @@ -71,9 +85,6 @@ public void testBasic() throws InterruptedException, ExecutionException, @Test public void testLocals() throws ScriptException { - final Context context = new Context(); - final ScriptService scriptService = context.getService(ScriptService.class); - final ScriptLanguage language = scriptService.getLanguageByExtension("py"); final ScriptEngine engine = language.getScriptEngine(); assertEquals(JythonScriptEngine.class, engine.getClass()); @@ -90,9 +101,6 @@ public void testLocals() throws ScriptException { public void testParameters() throws InterruptedException, ExecutionException, IOException, ScriptException { - final Context context = new Context(); - final ScriptService scriptService = context.getService(ScriptService.class); - final String script = "" + // "# @ScriptService ss\n" + // "# @OUTPUT String language\n" + // @@ -129,9 +137,6 @@ public void testParameters() throws InterruptedException, ExecutionException, public void testLongType() throws InterruptedException, ExecutionException, IOException, ScriptException { - final Context context = new Context(); - final ScriptService scriptService = context.getService(ScriptService.class); - final String script = "" + // "# @OUTPUT String varType\n" + // "a = 10L\n" + // From c8e8fdef345779c588fb1eaeb02d91f8e3feaedc Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sat, 18 Feb 2017 09:52:04 +0000 Subject: [PATCH 54/94] Wrap the stock Jython JSR-223 ScriptEngine We wanted to do this before, but 2.5.3 has a bug which did not occur with the SciJava ScriptEngine implementation, so we stuck with that. But now that we switched to Jython 2.7.0, it is no longer an issue. --- .../jython/JythonScriptLanguage.java | 9 --------- .../plugins/scripting/jython/JythonTest.java | 19 ++++++++++--------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index 4ba51d5..becdbc5 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -62,15 +62,6 @@ public JythonScriptLanguage() { super("jython"); } - @Override - public ScriptEngine getScriptEngine() { - // NB: recursive priorities can only be resolved via inter-service - // dependencies. There is no way to make the ScriptService - // depend on the JythonService because of the hierarchy - // of components. So we have to get the JythonService indirectly. - return context.service(JythonService.class).getScriptEngine(); - } - @Override public Object decode(final Object object) { if (object instanceof PyNone) return null; diff --git a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java index 58a3456..3544098 100644 --- a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java +++ b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java @@ -46,6 +46,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.python.jsr223.PyScriptEngine; import org.scijava.Context; import org.scijava.script.ScriptLanguage; import org.scijava.script.ScriptModule; @@ -87,7 +88,7 @@ public void testBasic() throws InterruptedException, ExecutionException, public void testLocals() throws ScriptException { final ScriptLanguage language = scriptService.getLanguageByExtension("py"); final ScriptEngine engine = language.getScriptEngine(); - assertEquals(JythonScriptEngine.class, engine.getClass()); + assertEquals(PyScriptEngine.class, engine.getClass()); engine.put("hello", 17); assertEquals(17, language.decode(engine.eval("hello"))); assertEquals(17, language.decode(engine.get("hello"))); @@ -117,20 +118,20 @@ public void testParameters() throws InterruptedException, ExecutionException, * Tests that variables assigned a primitive long value have the expected * type. *

- * There is a crazy bug in {@link org.python.jsr223.PyScriptEngine}, which - * results in variables assigned a long primitive to somehow end up as (or + * There was a crazy bug in {@link PyScriptEngine} version 2.5.3, which + * resulted in variables assigned a long primitive to somehow end up as (or * appearing to end up as) {@link java.math.BigInteger} instances instead. See * this thread on the jython-users mailing list for discussion. *

*

- * This test ensures that that specific problem gets flagged if it occurs. As - * long as we keep using our own Jython {@code ScriptEngine} implementation - * (i.e.: {@link org.scijava.plugins.scripting.jython.JythonScriptEngine}), - * the problem does not occur. But if we switch to the stock JSR-223 Jython - * {@code ScriptEngine} (i.e.: {@link org.python.jsr223.PyScriptEngine}), the - * problem manifests. See {@link JythonScriptLanguage#getScriptEngine()}. + * This test ensures that that specific problem gets flagged if it recurs. + * Previously, to avoid it, we used our own Jython {@code ScriptEngine} + * implementation + * ({@code org.scijava.plugins.scripting.jython.JythonScriptEngine}). But + * since Jython 2.7.0, the stock JSR-223 Jython {@code ScriptEngine} (i.e.: + * {@link org.python.jsr223.PyScriptEngine}) no longer has this issue. *

*/ @Test From 6cd83454591a079372464f3e7986cf85aaabeee2 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sat, 18 Feb 2017 09:58:16 +0000 Subject: [PATCH 55/94] Remove email address from @author tag --- .../scijava/plugins/scripting/jython/JythonScriptLanguage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index becdbc5..1678ebe 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -49,7 +49,7 @@ * An adapter of the Jython interpreter to the SciJava scripting interface. * * @author Johannes Schindelin - * @author Mark Hiner + * @author Mark Hiner * @see ScriptEngine */ @Plugin(type = ScriptLanguage.class, name = "Python") From 91ec0fd4506d28bbf69c129c2bbc63f8d973a743 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sat, 18 Feb 2017 10:06:07 +0000 Subject: [PATCH 56/94] Add some simple tests for eval With the custom SciJava Jython ScriptEngine implementation, the eval support was rather broken. For example, the expression "v=1" would say: SyntaxError: ("mismatched input '=' expecting EOF", ('', 1, 1, 'v=1\n')) Fortunately, the stock Jython 2.7.0 ScriptEngine works. --- .../plugins/scripting/jython/JythonTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java index 3544098..3559274 100644 --- a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java +++ b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java @@ -36,6 +36,7 @@ import static org.junit.Assert.assertSame; import java.io.IOException; +import java.math.BigInteger; import java.util.concurrent.ExecutionException; import javax.script.Bindings; @@ -148,4 +149,22 @@ public void testLongType() throws InterruptedException, ExecutionException, final String expected = ""; assertEquals(expected, actual); } + + @Test + public void testEval() throws ScriptException { + final ScriptLanguage language = scriptService.getLanguageByExtension("py"); + final ScriptEngine engine = language.getScriptEngine(); + assertEquals(PyScriptEngine.class, engine.getClass()); + + final Object sum = engine.eval("2 + 3"); + assertEquals(5, sum); + + final String n1 = "112233445566778899"; + final String n2 = "998877665544332211"; + final Object bigNum = engine.eval(n1 + "*" + n2); + assertEquals(new BigInteger(n1).multiply(new BigInteger(n2)), bigNum); + + final Object varAssign = engine.eval("a = 4 + 5"); + assertNull(varAssign); + } } From a0187ab4239bdfd2cf73ea5e23aba6add180c30e Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 14 Mar 2017 14:40:47 -0500 Subject: [PATCH 57/94] POM: use a better URL --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2f836cc..a4689ea 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. - http://scijava.org/ + https://github.com/scijava/scripting-jython 2008 SciJava From c71e786282f4aac67024fb7122362a8c2bb3f320 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sat, 18 Feb 2017 09:53:22 +0000 Subject: [PATCH 58/94] Remove unused classes These classes were no longer being used by the Jython script language. Unfortunately, there are now probably problems with dangling references. --- .../jython/DefaultJythonService.java | 90 -------- .../scripting/jython/JythonBindings.java | 211 ------------------ .../jython/JythonReferenceCleaner.java | 185 --------------- .../scripting/jython/JythonScriptEngine.java | 103 --------- .../scripting/jython/JythonService.java | 54 ----- 5 files changed, 643 deletions(-) delete mode 100644 src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java delete mode 100644 src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java delete mode 100644 src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java delete mode 100644 src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java delete mode 100644 src/main/java/org/scijava/plugins/scripting/jython/JythonService.java diff --git a/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java b/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java deleted file mode 100644 index 62465a8..0000000 --- a/src/main/java/org/scijava/plugins/scripting/jython/DefaultJythonService.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * #%L - * JSR-223-compliant Jython scripting language plugin. - * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.plugins.scripting.jython; - -import javax.script.ScriptEngine; - -import org.scijava.log.LogService; -import org.scijava.plugin.Parameter; -import org.scijava.plugin.Plugin; -import org.scijava.service.AbstractService; -import org.scijava.service.Service; -import org.scijava.thread.ThreadService; - -/** - * Default {@link JythonService} implementation. Maintains a - * {@link JythonReferenceCleaner} instance. - * - * @author Mark Hiner hinerm at gmail.com - */ -@Plugin(type = Service.class) -public class DefaultJythonService extends AbstractService implements - JythonService -{ - - // -- Fields -- - - private JythonReferenceCleaner cleaner; - - // -- Parameters -- - - @Parameter - private ThreadService threadService; - - @Parameter - private LogService logService; - - // -- JythonService methods -- - - @Override - public ScriptEngine getScriptEngine() { - // TODO: Consider adapting the wrapped ScriptEngineFactory's - // ScriptEngine. - final JythonScriptEngine engine = new JythonScriptEngine(); - cleaner.queueCleanup(engine, threadService, logService); - return engine; - } - - // -- Service methods -- - - @Override - public void initialize() { - cleaner = new JythonReferenceCleaner(); - } - - // -- Disposable methods -- - - @Override - public void dispose() { - cleaner.shutDown(); - } -} diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java deleted file mode 100644 index cef01ce..0000000 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonBindings.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * #%L - * JSR-223-compliant Jython scripting language plugin. - * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.plugins.scripting.jython; - -import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.script.Bindings; - -import org.python.core.PyStringMap; -import org.python.util.PythonInterpreter; -import org.scijava.script.ScriptModule; - -/** - * A {@link Bindings} wrapper around Jython's local variables. - * - * @author Johannes Schindelin - */ -public class JythonBindings implements Bindings { - - protected final PythonInterpreter interpreter; - - /* - * NB: In our JythonScriptLanguage we explain the need for cleaning - * up after a PythonInterpreter and declare the scope of a - * Python environment to be equal to the lifetime of its parent - * JythonScriptEngine. - * As triggering our cleaning method involves PhantomReferences - * we must ensure that JythonScriptEngines can actually be - * garbage collected when it is no longer in use. - * To do this, we have to prevent JythonScriptEngines from - * being passed to the PythonInterpreter - which would then - * create a hard reference to the ScriptEngine through the - * static PySystemState. - * Similarly we do not want to pass ScriptModules to the - * PythonInterpreter, as the ScriptModule has a hard - * reference to its ScriptEngine. - */ - private final Map> shallowMap = new HashMap<>(); - - public JythonBindings(final PythonInterpreter interpreter) { - this.interpreter = interpreter; - } - - @Override - public int size() { - return interpreter.getLocals().__len__(); - } - - @Override - public boolean isEmpty() { - return size() == 0; - } - - @Override - public boolean containsKey(final Object key) { - return get(key) != null; - } - - @Override - public boolean containsValue(final Object value) { - for (final Object value2 : values()) { - if (value.equals(value2)) return true; - } - return false; - } - - @Override - public Object get(final Object key) { - if (shallowMap.containsKey(key)) { - return shallowMap.get(key).get(); - } - - try { - return interpreter.get((String) key); - } - catch (final Error e) { - return null; - } - } - - @Override - public Object put(final String key, final Object value) { - final Object result = get(key); - - if (value instanceof ScriptModule || value instanceof JythonScriptEngine) { - shallowMap.put(key, new WeakReference<>(value)); - } - else { - try { - interpreter.set(key, value); - } - catch (final Error e) { - // ignore - } - } - - return result; - } - - @Override - public Object remove(final Object key) { - final Object result = get(key); - if (shallowMap.containsKey(key)) shallowMap.remove(key); - else if (result != null) interpreter.getLocals().__delitem__((String) key); - - return result; - } - - @Override - public void putAll(final Map toMerge) { - for (final Entry entry : toMerge - .entrySet()) - { - put(entry.getKey(), entry.getValue()); - } - } - - private PyStringMap dict() { - return (PyStringMap) interpreter.getLocals(); - } - - @Override - public void clear() { - dict().clear(); - } - - @Override - public Set keySet() { - final Set result = new HashSet<>(); - for (final Object name : dict().keys()) { - result.add(name.toString()); - } - return result; - } - - @Override - public Collection values() { - final List result = new ArrayList<>(); - for (final Object name : dict().keys()) { - try { - result.add(get(name)); - } - catch (final Error exc) { - // ignore for now - } - } - return result; - } - - @Override - public Set> entrySet() { - final Set> result = new HashSet<>(); - for (final Object name : dict().keys()) { - result.add(new Entry() { - - @Override - public String getKey() { - return name.toString(); - } - - @Override - public Object getValue() { - return get(name); - } - - @Override - public Object setValue(final Object value) { - throw new UnsupportedOperationException(); - } - }); - } - return result; - } - -} diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java deleted file mode 100644 index c5ff8fc..0000000 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonReferenceCleaner.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * #%L - * JSR-223-compliant Jython scripting language plugin. - * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.plugins.scripting.jython; - -import java.lang.ref.PhantomReference; -import java.lang.ref.ReferenceQueue; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - -import org.python.core.PyObject; -import org.python.util.PythonInterpreter; -import org.scijava.log.LogService; -import org.scijava.thread.ThreadService; - -/** - * A helper class for purging dangling references within a Jython interpreter - * after it executes a script. - * - * @author Mark Hiner - */ -public class JythonReferenceCleaner { - - // List of PhantomReferences and corresponding ReferenceQueue to - // facilitate proper PhantomReference use. - // See http://resources.ej-technologies.com/jprofiler/help/doc/index.html - - private final LinkedList phantomReferences = - new LinkedList<>(); - private final ReferenceQueue queue = - new ReferenceQueue<>(); - - private boolean shutDown = false; - - /** Queues the future cleanup operation on a separate thread, */ - public synchronized void queueCleanup(final JythonScriptEngine engine, - final ThreadService threadService, final LogService log) - { - // NB: This phantom reference is used to clean up any local variables - // created by evaluation of scripts via this ScriptEngine. We need - // to use PhantomReferences because the "scope" of a script extends - // beyond its eval method - a consumer may still want to inspect - // the state of variables after evaluation. - // - // By using PhantomReferences we are saying that the scope of - // script evaluation equals the lifetime of the ScriptEngine. - phantomReferences.add(new JythonEnginePhantomReference(engine, queue)); - - // NB: The use of PhantomReferences requires a paired polling thread. - // We poll instead of blocking for input to avoid leaving lingering - // threads that would need to be interrupted - instead only starting - // threads running when there is actually a PhantomReference that - // will eventually be enqueued. - // - // Here we check if there is already a polling thread in operation - - // if not, we start a new thread. - if (phantomReferences.size() == 1) { - threadService.run(new Runnable() { - - @Override - public void run() { - boolean done = false; - - // poll the queue - while (!done) { - try { - Thread.sleep(100); - - synchronized (JythonReferenceCleaner.this) { - // poll the queue - final JythonEnginePhantomReference ref = - (JythonEnginePhantomReference) queue.poll(); - - // if we have a ref, clean it up - if (ref != null) { - ref.cleanup(); - phantomReferences.remove(ref); - } - - // Once we're done with our known phantom refs - // we can let this thread shut down - done = phantomReferences.size() == 0 || shutDown; - } - - } - catch (final Exception ex) { - // log exception, continue - log.error(ex); - } - } - } - }); - } - } - - public void shutDown() { - shutDown = true; - } - - // -- Helper classes -- - - /** - * Helper class to clean up {@link PythonInterpreter} local variables when a - * parent {@link JythonScriptEngine} leaves scope. - */ - private static class JythonEnginePhantomReference extends - PhantomReference - { - - public PythonInterpreter interpreter; - - public JythonEnginePhantomReference(final JythonScriptEngine engine, - final ReferenceQueue queue) - { - super(engine, queue); - interpreter = engine.interpreter; - } - - public void cleanup() { - final List scriptLocals = new ArrayList<>(); - final PythonInterpreter interp = interpreter; - if (interp == null) return; - - // NB: This method for cleaning up local variables was taken from: - // http://python.6.x6.nabble.com/Cleaning-up-PythonInterpreter-object-td1777184.html - // - // Because Python is an interpreted language, when a Python script - // creates new variables they stick around in a static - // org.python.core.PySystemState variable (defaultSystemState) - // the org.python.core.Py class. - // - // Thus an implicit static state is created by script evaluation, - // so we must manually clean up local variables known to the - // interpreter when the scope of an executed script is over. - // - // See original bug report for the leak that prompted this solution: - // http://fiji.sc/bugzilla/show_bug.cgi?id=1203 - - final PyObject locals = interp.getLocals(); - for (final PyObject item : locals.__iter__().asIterable()) { - final String localVar = item.toString(); - // Ignore __name__ and __doc__ variables, which are special - // and known not to be local variables created by evaluation. - if (!localVar.contains("__name__") && !localVar.contains("__doc__")) { - // Build list of variables to clean - scriptLocals.add(item.toString()); - } - } - // Null out local variables - for (final String string : scriptLocals) { - interp.set(string, null); - } - } - } - -} diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java deleted file mode 100644 index dceb5c1..0000000 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptEngine.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * #%L - * JSR-223-compliant Jython scripting language plugin. - * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.plugins.scripting.jython; - -import java.io.Reader; -import java.io.Writer; - -import javax.script.ScriptContext; -import javax.script.ScriptEngine; -import javax.script.ScriptException; - -import org.python.core.Py; -import org.python.util.PythonInterpreter; -import org.scijava.script.AbstractScriptEngine; - -/** - * A Python interpreter based on Jython. - * - * @author Johannes Schindelin - */ -public class JythonScriptEngine extends AbstractScriptEngine { - - protected final PythonInterpreter interpreter; - - public JythonScriptEngine() { - interpreter = new PythonInterpreter(); - engineScopeBindings = new JythonBindings(interpreter); - } - - @Override - public Object eval(final String script) throws ScriptException { - setup(); - try { - return interpreter.eval(script); - } - catch (final Exception e) { - throw new ScriptException(e); - } - } - - @Override - public Object eval(final Reader reader) throws ScriptException { - setup(); - try { - final String filename = getString(ScriptEngine.FILENAME); - return Py.runCode(interpreter.compile(reader, filename), null, interpreter - .getLocals()); - } - catch (final Exception e) { - throw new ScriptException(e); - } - } - - protected void setup() { - final ScriptContext context = getContext(); - final Reader reader = context.getReader(); - if (reader != null) { - interpreter.setIn(reader); - } - final Writer writer = context.getWriter(); - if (writer != null) { - interpreter.setOut(writer); - } - final Writer errorWriter = context.getErrorWriter(); - if (errorWriter != null) { - interpreter.setErr(errorWriter); - } - } - - private String getString(final String key) { - final Object result = get(key); - return result == null ? null : result.toString(); - } -} diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java deleted file mode 100644 index d3ae506..0000000 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonService.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * #%L - * JSR-223-compliant Jython scripting language plugin. - * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.plugins.scripting.jython; - -import javax.script.ScriptEngine; - -import org.scijava.service.SciJavaService; -import org.scijava.service.Service; - -/** - * {@link Service} for managing contextual Jython metadata. - *

- * The {@link #getScriptEngine()} method should be used to access - * {@link JythonScriptEngine} instances, to ensure they are cleaned properly. - *

- * - * @author Mark Hiner hinerm at gmail.com - */ -public interface JythonService extends SciJavaService { - - /** - * @return Get a Jython {@link ScriptEngine} instance. - */ - ScriptEngine getScriptEngine(); -} From 4cc0fbb90aba6109c22ea7bc686d05d2a66893bc Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 11 Apr 2017 09:23:34 -0500 Subject: [PATCH 59/94] Follow up on potential memory leak issue I make an empty commit here to clarify the comments on the previous one. I tested whether memory leaks still occur, but cannot reproduce anymore: The following script: # @IOService io data = io.open("/Users/curtis/data/dub.tif") print("data = " + str(data)) Where dub.tif is ~1GB in size, when run repeatedly, spikes memory usage to >1200MB, but after a few seconds plus a garbage collection operation drops back down to <50MB. So I'm going to declare the memory leak issue resolved, until/unless someone reports another such problem. See also fiji/fiji#160. From 1fc4e9d408380fed9ad229acea7ba7fa7aa8f638 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 26 Apr 2017 15:39:51 -0500 Subject: [PATCH 60/94] Fix the Travis configuration Without this, failed builds of master trigger another "mvn install". See: https://gist.github.com/ctrueden/ae0f024a0cdf2cb53c915d75b0759553 --- .travis/build.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis/build.sh b/.travis/build.sh index 4c2f8d2..8cddb5f 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -1,7 +1,10 @@ #!/bin/sh dir="$(dirname "$0")" -test "$TRAVIS_SECURE_ENV_VARS" = true \ +if [ "$TRAVIS_SECURE_ENV_VARS" = true \ -a "$TRAVIS_PULL_REQUEST" = false \ - -a "$TRAVIS_BRANCH" = master && - mvn -Pdeploy-to-imagej deploy --settings "$dir/settings.xml" || + -a "$TRAVIS_BRANCH" = master ] +then + mvn -Pdeploy-to-imagej deploy --settings "$dir/settings.xml" +else mvn install +fi From 213c1105b3c15d28504bfafc929cce9a2cbcc6f4 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 30 Apr 2017 14:15:03 -0500 Subject: [PATCH 61/94] Bump to next development cycle Signed-off-by: Curtis Rueden --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a4689ea..0c30866 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From f40b0fb4ea2d1af169b53b949b5dd9078bf4716f Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 5 Oct 2017 16:40:15 -0500 Subject: [PATCH 62/94] Update Travis configuration This will hopefully reduce the need for future en masse updates. --- .travis.yml | 6 +++--- .travis/build.sh | 11 ++--------- .travis/notify.sh | 2 -- 3 files changed, 5 insertions(+), 14 deletions(-) delete mode 100755 .travis/notify.sh diff --git a/.travis.yml b/.travis.yml index 2fd67bc..b2c8858 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,11 @@ language: java jdk: oraclejdk8 branches: - only: master + only: + - master + - "/.*-[0-9]+\\..*/" install: true script: ".travis/build.sh" -after_success: ".travis/notify.sh Travis-Success" -after_failure: ".travis/notify.sh Travis-Failure" env: global: - secure: JVq9EcQTLbGZTBWil2z/WKd84I2YsHQyIlhU6OmKSYIi4CZDb+4cl5rwLOlLeM+jlkX9eYHRfIRgscdAR1fBHFn+piXYjtsIsE3kHSnGSTmZklEk8VGsY5j0Y7FwZJj7CYrvEfAunYR5ivIpbESDzejjLPQVsMyq3EzrQ+FTM7o= diff --git a/.travis/build.sh b/.travis/build.sh index 8cddb5f..e939b6c 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -1,10 +1,3 @@ #!/bin/sh -dir="$(dirname "$0")" -if [ "$TRAVIS_SECURE_ENV_VARS" = true \ - -a "$TRAVIS_PULL_REQUEST" = false \ - -a "$TRAVIS_BRANCH" = master ] -then - mvn -Pdeploy-to-imagej deploy --settings "$dir/settings.xml" -else - mvn install -fi +curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/travis-build.sh +sh travis-build.sh diff --git a/.travis/notify.sh b/.travis/notify.sh deleted file mode 100755 index b3b239e..0000000 --- a/.travis/notify.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -curl -fs "https://jenkins.imagej.net/job/$1/buildWithParameters?token=$TOKEN_NAME&repo=$TRAVIS_REPO_SLUG&commit=$TRAVIS_COMMIT&pr=$TRAVIS_PULL_REQUEST" From a4499f2d0e6457887613c3a2f4f63161f8864b40 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 5 Oct 2017 16:40:15 -0500 Subject: [PATCH 63/94] POM: update pom-scijava parent to 17.1.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0c30866..9d78df7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 12.0.0 + 17.1.1 From 243dd22ca3396fffea3ae21cf262dbc90359f7cc Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 5 Oct 2017 16:40:15 -0500 Subject: [PATCH 64/94] POM: deploy releases to the ImageJ repository --- pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pom.xml b/pom.xml index 9d78df7..c4a3335 100644 --- a/pom.xml +++ b/pom.xml @@ -91,6 +91,9 @@ Institute of Molecular Cell Biology and Genetics. 2.7.0 ${jython.version} + + + deploy-to-imagej From 04d5be37e9b9ab439940cf8e7013be8f07e1f412 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 27 Apr 2018 15:51:59 -0700 Subject: [PATCH 65/94] Update Travis configuration --- .travis.yml | 9 +++++++-- .travis/build.sh | 2 +- .travis/settings.xml | 14 -------------- .travis/signingkey.asc.enc | Bin 0 -> 9632 bytes 4 files changed, 8 insertions(+), 17 deletions(-) delete mode 100644 .travis/settings.xml create mode 100644 .travis/signingkey.asc.enc diff --git a/.travis.yml b/.travis.yml index b2c8858..6195d39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,12 @@ branches: - "/.*-[0-9]+\\..*/" install: true script: ".travis/build.sh" +cache: + directories: + - "~/.m2/repository" env: global: - - secure: JVq9EcQTLbGZTBWil2z/WKd84I2YsHQyIlhU6OmKSYIi4CZDb+4cl5rwLOlLeM+jlkX9eYHRfIRgscdAR1fBHFn+piXYjtsIsE3kHSnGSTmZklEk8VGsY5j0Y7FwZJj7CYrvEfAunYR5ivIpbESDzejjLPQVsMyq3EzrQ+FTM7o= - - secure: GcG0+iBIi85qlcM0WrskXZVxVXsvRGeRMiNDuMWHVQ3skVV6kEtcqAgjTzMDllOwvsgHED3zoMRXFIjvhKPOQXtq6w55s6IVM2ytLjT1cJ6rVn8wzmHKCJUgQwQRa7CJvQcfAzess+teKhSFoGShGFiacaPHVfygtSgeZ0InJC0= + - secure: aX4SWYTGHkN6G78wY5s2le5MDDw+XjUmdEbCsLZJJsLbLoAC78sj3uOGidApulA4GJyCrRwhbTuULjY7leGkomzu3VgLKVRrce1yHO8RdZLaT4KuGe03E4NeNQmg+ljYXgG15o7xMRB/dRp8Z3RztwUY+MdvvX9D8YYDaTWcN8Q= + - secure: MTmdjjD9+93j7mOWB9FqVmZOnxSEQsq7Q1crQaFHWqecAqh5cwtOkirGe+rHD/S54gQIuRhJ7JcaOIp+ul/LbRPrkDOxaO+qMdp2oq6jSj3mIsDL6vHLXWyZHCbZGB0B+7msncUzrnPF7EpeDzFKJ919UWxOa6GhdsGhDpO6bIg= + - secure: XfMlmVZQhcdbaMULfpXRQGax/akt57HIC0fjo0nI38u1AzJpmEQEBfJEl52y9YB2i1pGI+F78PWiYFOw31xjF3vODWufN0JPXQmAV1JT0bgIALFEu/Z5ZQbIpeIPpoywNnEROFtNceNhh1P9KW1FzlxQfmavqtMMGMjcIhkfpF0= + - secure: EzZEisFMME/Zq8hC52V0G7wTc0eErCSh/+KiBbbTr5x7623L30x1ONkAZxw9tDkc7b7nhlf4QdaP8sfFNPxalgqHXcJ35UbCszokQoSwJRtwJW3V445j4fEJNemOSzQWlxPM6oEKWGQoIzbnvgBydCktagK+V5CBS4cegEqkeb8= diff --git a/.travis/build.sh b/.travis/build.sh index e939b6c..f377ec9 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -1,3 +1,3 @@ #!/bin/sh curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/travis-build.sh -sh travis-build.sh +sh travis-build.sh $encrypted_340118958087_key $encrypted_340118958087_iv diff --git a/.travis/settings.xml b/.travis/settings.xml deleted file mode 100644 index 71a5630..0000000 --- a/.travis/settings.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - imagej.releases - travis - ${env.MAVEN_PASS} - - - imagej.snapshots - travis - ${env.MAVEN_PASS} - - - diff --git a/.travis/signingkey.asc.enc b/.travis/signingkey.asc.enc new file mode 100644 index 0000000000000000000000000000000000000000..e0069b2d418bf8893f8167724306c54d0dffd1bc GIT binary patch literal 9632 zcmV;RC12W4PH{v)oRX|iOPYn8OU;EGim{t*Y=99XGC@NJ76w-I7|uKqU^!LkSbs^) zy|AFwNrY3jTv<7WY0%)2qOT#6Z%Snb6&r52dNTM=GdmITGE;6(mR)1Sd|!`?m+zp!cqleJ>vqI3t%=SM#pA>vn~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44A@gHTQziyJ?;_A9Pt~cHl$6xt?T&BR<1>2Jf7v zjLhN*aCPfT3>wEBN7!jWY<%pbFdu?55o(9?hAth@YymCj%#{`%?H^%H9#$p=IDHB2 zqbSQ|LE~?G3;BM7bot2EIsDfh#A{A2RSGZP zJ2D3>{=A-06KnIr*Q<2O_!aVpRxQ*vEk64cqi&S3=9{d_ye|`LqmhJ1w+lO<2;NmK zCAAJ?5(JqAM>yo%IjS3q8jCLLExFNSLVpL;=U67YnU%i~u!~;TB=~zPaid_6JDHV3 zgzg}}%8jFfK*PxKB`D(S+4an-o~ZB2c-I9wDTe6QtkjMLR!@poU?QIZ8RU7Yu%j$V ztn2OMoea!w-}8L_viVyWs4*6doxAbGO)maKn^f=eJ+p(Qf&)-pjLTiwf0c690~OQM zdl4@x<-d41>+;05+yy`0&RW+|-Qvvb2@_Z0;`*~E-~x7^A((;>frmy-5F0K1+4^~B zC7WKN)Tp@@&olMO-_=5@DDlV_N*3?oynP$46c>s_QS+8oCvEJpgBB9(=$lbBH);BwVrK=J5Kba31ACunvI25%01uF1_?5saMhQ z=uMVocSx>kxfg1*Lx(}>$h(goyoDNA%m6U1DLZ{Lr@Xiv2QqQSTG(!KPh-IM_8q$r zd&t0C)b#oa8$7lbEikN4USp(|pEH*0{FA@9uP%*YUY*X7+Ra8OGoYU#BPa$x=Ms#N z>ZBdv(@^ySkl3c(ctXu@lVBT+l&3rKSB=&rmZzzKizP*xKp0ec<&!MKzHxrwzb2pX z(QEj2$PPhCF~?!P403J_BY8phtd+*)k;XOwcGTw_nc_+V?$Dnp&O3>_8|ALR)KFB& zU#2g;ZcR)cCko*gWU`Uf#*Kd@&9 WihZ@?7@$M7dfmCMwZ>66nWV(ctI=8j literal 0 HcmV?d00001 From b1c11737f094ddfea50d69b6157bf7ecf26378f5 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 27 Apr 2018 15:52:38 -0700 Subject: [PATCH 66/94] POM: update to Jython 2.7.1 See #10. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c4a3335..6eb912e 100644 --- a/pom.xml +++ b/pom.xml @@ -89,7 +89,7 @@ Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. - 2.7.0 + 2.7.1 ${jython.version} From e112c83a27870059c7a2a4af48e61387c5c12897 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 27 Apr 2018 15:53:33 -0700 Subject: [PATCH 67/94] Bump to next development cycle Signed-off-by: Curtis Rueden --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6eb912e..78ec28a 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.4.2-SNAPSHOT + 0.4.3-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From e6e8aa7866b628b2c00de7bac0cfb553889063d3 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 21 Jun 2018 17:18:58 -0500 Subject: [PATCH 68/94] POM: exclude script_templates from license headers --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 78ec28a..a8c2bf7 100644 --- a/pom.xml +++ b/pom.xml @@ -88,6 +88,7 @@ Board of Regents of the University of Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. + **/script_templates/** 2.7.1 ${jython.version} From 3eb1a184479d77ffaf5af685eba27296c8d43cd2 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sat, 22 Dec 2018 18:47:08 -0600 Subject: [PATCH 69/94] Update dependency versions This updates the pom-scijava parent to 24.0.0, and the jython-shaded artifact to 2.7.1.1. --- pom.xml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index a8c2bf7..73aa7de 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 17.1.1 + 24.0.0 @@ -90,11 +90,10 @@ Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. **/script_templates/** - 2.7.1 - ${jython.version} - deploy-to-imagej + + 2.7.1.1 From bd90d6bf962e19d5490936c8d2c0b321848880e8 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 4 Apr 2019 13:35:33 -0500 Subject: [PATCH 70/94] POM: use HTTPS where feasible --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 73aa7de..522cf58 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 2008 SciJava - http://scijava.org/ + https://scijava.org/ @@ -31,7 +31,7 @@ ctrueden Curtis Rueden - http://imagej.net/User:Rueden + https://imagej.net/User:Rueden lead developer @@ -45,13 +45,13 @@ Johannes Schindelin - http://imagej.net/User:Schindelin + https://imagej.net/User:Schindelin founder dscho Mark Hiner - http://imagej.net/User:Hinerm + https://imagej.net/User:Hinerm hinerm From 6716dcda35beed8f8308b8cc4cd3a62f0598446d Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 30 Apr 2019 17:04:49 -0500 Subject: [PATCH 71/94] POM: maven.imagej.net -> maven.scijava.org --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 522cf58..d305799 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 24.0.0 + 26.0.0 @@ -90,8 +90,8 @@ Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. **/script_templates/** - - deploy-to-imagej + + deploy-to-scijava 2.7.1.1 From 4ecf7f687ae623b340345a1877ca817253b4139b Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 30 Apr 2019 17:04:49 -0500 Subject: [PATCH 72/94] Travis: build using openjdk8 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6195d39..1c306b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: java -jdk: oraclejdk8 +jdk: openjdk8 branches: only: - master From f85f62ee316dde890a6d4a570020ae267f918bde Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 6 Jun 2019 18:57:01 -0500 Subject: [PATCH 73/94] Update to current script parameter syntax --- src/main/resources/script_templates/Intro/Greeting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/script_templates/Intro/Greeting.py b/src/main/resources/script_templates/Intro/Greeting.py index 210aaa6..00bae41 100644 --- a/src/main/resources/script_templates/Intro/Greeting.py +++ b/src/main/resources/script_templates/Intro/Greeting.py @@ -1,5 +1,5 @@ -# @String(label="Please enter your name",description="Name field") name -# @OUTPUT String greeting +#@ String (label="Please enter your name", description="Name field") name +#@output String greeting # A Jython script with parameters. # It is the duty of the scripting framework to harvest From 101294957349d310aa7fd5567b6d6e8f9ff63ee3 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 23 Oct 2019 09:52:42 -0500 Subject: [PATCH 74/94] POM: update parent to pom-scijava 27.0.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d305799..cd2980e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 26.0.0 + 27.0.1 From 6c060d5b5386a443e05c5100a6d2b097a3d763ee Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 23 Oct 2019 12:03:42 -0500 Subject: [PATCH 75/94] Bump to next development cycle Signed-off-by: Curtis Rueden --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cd2980e..312eb53 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.4.3-SNAPSHOT + 0.4.4-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From 1c43d53f0766c98dd8e313b5cad98fc414464bce Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 4 Nov 2019 08:31:33 -0600 Subject: [PATCH 76/94] JythonTest: use new-style parameter syntax --- .../org/scijava/plugins/scripting/jython/JythonTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java index 3559274..efd0766 100644 --- a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java +++ b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java @@ -104,8 +104,8 @@ public void testParameters() throws InterruptedException, ExecutionException, IOException, ScriptException { final String script = "" + // - "# @ScriptService ss\n" + // - "# @OUTPUT String language\n" + // + "#@ ScriptService ss\n" + // + "#@output String language\n" + // "language = ss.getLanguageByName('jython').getLanguageName()\n"; final ScriptModule m = scriptService.run("hello.py", script, true).get(); @@ -140,7 +140,7 @@ public void testLongType() throws InterruptedException, ExecutionException, IOException, ScriptException { final String script = "" + // - "# @OUTPUT String varType\n" + // + "#@output String varType\n" + // "a = 10L\n" + // "varType = type(a)\n"; final ScriptModule m = scriptService.run("longType.py", script, true).get(); From e58ebcbf505c3bfe4fb75b061bfb23b08b0ef1fe Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 4 Nov 2019 08:32:13 -0600 Subject: [PATCH 77/94] JythonTest: add test of os.getpid() The test fails with versions of jython-shaded before 2.7.1.1; e.g.: mvn -Djython-shaded.version=2.7.1 test See scijava/jython-shaded#5. --- .../plugins/scripting/jython/JythonTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java index efd0766..c732b1e 100644 --- a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java +++ b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java @@ -34,6 +34,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.math.BigInteger; @@ -167,4 +168,19 @@ public void testEval() throws ScriptException { final Object varAssign = engine.eval("a = 4 + 5"); assertNull(varAssign); } + + @Test + public void testGetPID() throws InterruptedException, ExecutionException, + IOException, ScriptException + { + final String script = "" + // + "#@output Object pid\n" + // + "import os\n" + // + "pid = os.getpid()\n"; + final ScriptModule m = scriptService.run("getpid.py", script, true).get(); + + final Object pid = m.getOutput("pid"); + assertTrue(pid instanceof Number); + assertTrue(((Number) pid).longValue() > 0); + } } From 8cfd1e8ade547595e269517aa6388beb43afc142 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 4 Nov 2019 08:38:46 -0600 Subject: [PATCH 78/94] Update to Jython 2.7.2b2 Work by the Jython team has improved the dependency situation. There is now a jython-slim artifact with modular dependencies. We can use this to depend on Jython now, instead of jython-shaded. See also scijava/jython-shaded#7. --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 312eb53..3f60a47 100644 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,7 @@ Institute of Molecular Cell Biology and Genetics. deploy-to-scijava - 2.7.1.1 + 2.7.2b2 @@ -105,9 +105,9 @@ Institute of Molecular Cell Biology and Genetics. - org.scijava - jython-shaded - ${jython-shaded.version} + org.python + jython-slim + ${jython-slim.version} From add77f86a5f0fd5228df53a9ed58c0d41bb08aec Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 4 Nov 2019 08:51:29 -0600 Subject: [PATCH 79/94] Bump to next development cycle Signed-off-by: Curtis Rueden --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3f60a47..2446ea0 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.4.4-SNAPSHOT + 0.5.1-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From 8a493385293a60a28ecbce9efc464309e9fa5413 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 4 May 2020 16:38:32 -0500 Subject: [PATCH 80/94] Update Jython to 2.7.2 final release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2446ea0..37e280a 100644 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,7 @@ Institute of Molecular Cell Biology and Genetics. deploy-to-scijava - 2.7.2b2 + 2.7.2 From c72f7d36fa133d3f9752d15edfa1c50d84b83595 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 4 May 2020 16:56:26 -0500 Subject: [PATCH 81/94] Bump to next development cycle Signed-off-by: Curtis Rueden --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 37e280a..07e8ac3 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 0.5.1-SNAPSHOT + 1.0.1-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From 9339ea402edb3e8fc54938f86baed81f86ec89aa Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 1 Jul 2021 15:47:52 -0500 Subject: [PATCH 82/94] Switch from Travis CI to GitHub Actions --- .github/build.sh | 3 +++ .github/setup.sh | 3 +++ .github/workflows/build-main.yml | 42 +++++++++++++++++++++++++++++++ .github/workflows/build-pr.yml | 35 ++++++++++++++++++++++++++ .travis.yml | 17 ------------- .travis/build.sh | 3 --- .travis/signingkey.asc.enc | Bin 9632 -> 0 bytes README.md | 2 +- pom.xml | 6 ++--- 9 files changed, 87 insertions(+), 24 deletions(-) create mode 100755 .github/build.sh create mode 100755 .github/setup.sh create mode 100644 .github/workflows/build-main.yml create mode 100644 .github/workflows/build-pr.yml delete mode 100644 .travis.yml delete mode 100755 .travis/build.sh delete mode 100644 .travis/signingkey.asc.enc diff --git a/.github/build.sh b/.github/build.sh new file mode 100755 index 0000000..7da4262 --- /dev/null +++ b/.github/build.sh @@ -0,0 +1,3 @@ +#!/bin/sh +curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/ci-build.sh +sh ci-build.sh diff --git a/.github/setup.sh b/.github/setup.sh new file mode 100755 index 0000000..f359bbe --- /dev/null +++ b/.github/setup.sh @@ -0,0 +1,3 @@ +#!/bin/sh +curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/ci-setup-github-actions.sh +sh ci-setup-github-actions.sh diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml new file mode 100644 index 0000000..45b6b5e --- /dev/null +++ b/.github/workflows/build-main.yml @@ -0,0 +1,42 @@ +name: build + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Cache m2 folder + uses: actions/cache@v2 + env: + cache-name: cache-m2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-build-${{ env.cache-name }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'zulu' + - name: Set up CI environment + run: .github/setup.sh + - name: Execute the build + run: .github/build.sh + env: + GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + MAVEN_USER: ${{ secrets.MAVEN_USER }} + MAVEN_PASS: ${{ secrets.MAVEN_PASS }} + OSSRH_PASS: ${{ secrets.OSSRH_PASS }} + SIGNING_ASC: ${{ secrets.SIGNING_ASC }} diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml new file mode 100644 index 0000000..92a0192 --- /dev/null +++ b/.github/workflows/build-pr.yml @@ -0,0 +1,35 @@ +name: build PR + +on: + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Cache m2 folder + uses: actions/cache@v2 + env: + cache-name: cache-m2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-build-${{ env.cache-name }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'zulu' + - name: Set up CI environment + run: .github/setup.sh + - name: Execute the build + run: .github/build.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1c306b8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: java -jdk: openjdk8 -branches: - only: - - master - - "/.*-[0-9]+\\..*/" -install: true -script: ".travis/build.sh" -cache: - directories: - - "~/.m2/repository" -env: - global: - - secure: aX4SWYTGHkN6G78wY5s2le5MDDw+XjUmdEbCsLZJJsLbLoAC78sj3uOGidApulA4GJyCrRwhbTuULjY7leGkomzu3VgLKVRrce1yHO8RdZLaT4KuGe03E4NeNQmg+ljYXgG15o7xMRB/dRp8Z3RztwUY+MdvvX9D8YYDaTWcN8Q= - - secure: MTmdjjD9+93j7mOWB9FqVmZOnxSEQsq7Q1crQaFHWqecAqh5cwtOkirGe+rHD/S54gQIuRhJ7JcaOIp+ul/LbRPrkDOxaO+qMdp2oq6jSj3mIsDL6vHLXWyZHCbZGB0B+7msncUzrnPF7EpeDzFKJ919UWxOa6GhdsGhDpO6bIg= - - secure: XfMlmVZQhcdbaMULfpXRQGax/akt57HIC0fjo0nI38u1AzJpmEQEBfJEl52y9YB2i1pGI+F78PWiYFOw31xjF3vODWufN0JPXQmAV1JT0bgIALFEu/Z5ZQbIpeIPpoywNnEROFtNceNhh1P9KW1FzlxQfmavqtMMGMjcIhkfpF0= - - secure: EzZEisFMME/Zq8hC52V0G7wTc0eErCSh/+KiBbbTr5x7623L30x1ONkAZxw9tDkc7b7nhlf4QdaP8sfFNPxalgqHXcJ35UbCszokQoSwJRtwJW3V445j4fEJNemOSzQWlxPM6oEKWGQoIzbnvgBydCktagK+V5CBS4cegEqkeb8= diff --git a/.travis/build.sh b/.travis/build.sh deleted file mode 100755 index f377ec9..0000000 --- a/.travis/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/travis-build.sh -sh travis-build.sh $encrypted_340118958087_key $encrypted_340118958087_iv diff --git a/.travis/signingkey.asc.enc b/.travis/signingkey.asc.enc deleted file mode 100644 index e0069b2d418bf8893f8167724306c54d0dffd1bc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9632 zcmV;RC12W4PH{v)oRX|iOPYn8OU;EGim{t*Y=99XGC@NJ76w-I7|uKqU^!LkSbs^) zy|AFwNrY3jTv<7WY0%)2qOT#6Z%Snb6&r52dNTM=GdmITGE;6(mR)1Sd|!`?m+zp!cqleJ>vqI3t%=SM#pA>vn~1qG#H#AM`w ztgfy~Z#MC-r1!#_DG|Zh2l==b>abwIL<}2Fzb|1Vb0v)x>HMMjI;U*{fJP0U!WNEN zw5SLgU01xRtN$8uC!MxnG-h` z@-g)=sgTb8%)f{ZUD^vRVhYL@w_^MB+iY#a{cA3O7mCW0zr9|IJZY z4_lzE&(#nl>H8v}yp8KwtH0_B+7g)fJ$dv{6Jz;A7_bFS-Nk(Qrj|U_C647rlZ$!> zewNUp{)IKkr^y+xz3Rm^Oe(&N-f$t>2!&_M<&6A2u+Iv@Wfg)bzfTWXHUjt{1Q7X; zz}TU?RQcYdZit~Wvw(1tlPJ*<~a|i;3lUk?Nuvf8N4}cEiHI#MtB0mP^ zI$#o)V6lEv^l&sn6g#ErBoA+64R_?DaOsQ)jtl}}z#}|tSVSaE^=ldLCQDXPx)j`- zf8sdGEkk)>&DvHR>ijj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~E-~x7^A((;>frmy-5F0K1+4^~B zC7WKN)Tp@@&olMO-_=5@DDlV_N*3?oynP$46c>s_QS+8oCvEJpgBB9(=$lbBH);BwVrK=J5Kba31ACunvI25%01uF1_?5saMhQ z=uMVocSx>kxfg1*Lx(}>$h(goyoDNA%m6U1DLZ{Lr@Xiv2QqQSTG(!KPh-IM_8q$r zd&t0C)b#oa8$7lbEikN4USp(|pEH*0{FA@9uP%*YUY*X7+Ra8OGoYU#BPa$x=Ms#N z>ZBdv(@^ySkl3c(ctXu@lVBT+l&3rKSB=&rmZzzKizP*xKp0ec<&!MKzHxrwzb2pX z(QEj2$PPhCF~?!P403J_BY8phtd+*)k;XOwcGTw_nc_+V?$Dnp&O3>_8|ALR)KFB& zU#2g;ZcR)cCko*gWU`Uf#*Kd@&9 WihZ@?7@$M7dfmCMwZ>66nWV(ctI=8j diff --git a/README.md b/README.md index 807843a..c46d24b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![](https://travis-ci.org/scijava/scripting-jython.svg?branch=master)](https://travis-ci.org/scijava/scripting-jython) +[![](https://github.com/scijava/scripting-jython/actions/workflows/build-main.yml/badge.svg)](https://github.com/scijava/scripting-jython/actions/workflows/build-main.yml) # Jython Scripting diff --git a/pom.xml b/pom.xml index 07e8ac3..b322e51 100644 --- a/pom.xml +++ b/pom.xml @@ -77,8 +77,8 @@ https://github.com/scijava/scripting-jython/issues - Travis CI - https://travis-ci.org/scijava/scripting-jython + GitHub Actions + https://github.com/scijava/scripting-jython/actions @@ -91,7 +91,7 @@ Institute of Molecular Cell Biology and Genetics. **/script_templates/** - deploy-to-scijava + sign,deploy-to-scijava 2.7.2 From 230783304d6f067b190c5789007fd59d7c3f0745 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 2 Jul 2021 09:49:55 -0500 Subject: [PATCH 83/94] CI: build release tags --- .github/workflows/build-main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml index 45b6b5e..3fb5622 100644 --- a/.github/workflows/build-main.yml +++ b/.github/workflows/build-main.yml @@ -4,6 +4,8 @@ on: push: branches: - master + tags: + - "*-[0-9]+.*" jobs: build: From 6dfb2b9c3870a03f5d6a7607157187d06ead44fe Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 8 Nov 2021 15:42:39 -0600 Subject: [PATCH 84/94] POM: Stop using git:// protocol with github.com The GitHub platform is discontinuing support for it. See: https://github.blog/2021-09-01-improving-git-protocol-security-github/#whats-changing --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b322e51..9c1ba9b 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ - scm:git:git://github.com/scijava/scripting-jython + scm:git:https://github.com/scijava/scripting-jython scm:git:git@github.com:scijava/scripting-jython HEAD https://github.com/scijava/scripting-jython From bc570dace6782d82bcd5fc12de4ad344e7e3111a Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 14 Jun 2022 15:54:30 -0500 Subject: [PATCH 85/94] CI: cache ~/.m2/repository correctly --- .github/workflows/build-main.yml | 18 +++--------------- .github/workflows/build-pr.yml | 18 +++--------------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml index 3fb5622..5ef5692 100644 --- a/.github/workflows/build-main.yml +++ b/.github/workflows/build-main.yml @@ -13,24 +13,12 @@ jobs: steps: - uses: actions/checkout@v2 - - - name: Cache m2 folder - uses: actions/cache@v2 - env: - cache-name: cache-m2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-build-${{ env.cache-name }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Set up JDK 8 - uses: actions/setup-java@v2 + - name: Set up Java + uses: actions/setup-java@v3 with: java-version: '8' distribution: 'zulu' + cache: 'maven' - name: Set up CI environment run: .github/setup.sh - name: Execute the build diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 92a0192..925b576 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -11,24 +11,12 @@ jobs: steps: - uses: actions/checkout@v2 - - - name: Cache m2 folder - uses: actions/cache@v2 - env: - cache-name: cache-m2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-build-${{ env.cache-name }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Set up JDK 8 - uses: actions/setup-java@v2 + - name: Set up Java + uses: actions/setup-java@v3 with: java-version: '8' distribution: 'zulu' + cache: 'maven' - name: Set up CI environment run: .github/setup.sh - name: Execute the build From f739b4a5471d16e6b1c02f733bbdc89ed9a1cb5d Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 29 Jun 2022 12:43:17 -0500 Subject: [PATCH 86/94] JythonTest: fix warnings --- .../plugins/scripting/jython/JythonTest.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java index c732b1e..fa9d1cd 100644 --- a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java +++ b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java @@ -36,7 +36,6 @@ import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -import java.io.IOException; import java.math.BigInteger; import java.util.concurrent.ExecutionException; @@ -76,12 +75,10 @@ public void tearDown() { } @Test - public void testBasic() throws InterruptedException, ExecutionException, - IOException, ScriptException - { + public void testBasic() throws InterruptedException, ExecutionException { final String script = "1 + 2"; final ScriptModule m = scriptService.run("add.py", script, true).get(); - final Object result = m.getLanguage().decode(m.getReturnValue()); + final Object result = m.getInfo().getLanguage().decode(m.getReturnValue()); assertSame(Integer.class, result.getClass()); assertEquals(3, result); } @@ -101,9 +98,7 @@ public void testLocals() throws ScriptException { } @Test - public void testParameters() throws InterruptedException, ExecutionException, - IOException, ScriptException - { + public void testParameters() throws InterruptedException, ExecutionException { final String script = "" + // "#@ ScriptService ss\n" + // "#@output String language\n" + // @@ -137,9 +132,7 @@ public void testParameters() throws InterruptedException, ExecutionException, *

*/ @Test - public void testLongType() throws InterruptedException, ExecutionException, - IOException, ScriptException - { + public void testLongType() throws InterruptedException, ExecutionException { final String script = "" + // "#@output String varType\n" + // "a = 10L\n" + // @@ -170,9 +163,7 @@ public void testEval() throws ScriptException { } @Test - public void testGetPID() throws InterruptedException, ExecutionException, - IOException, ScriptException - { + public void testGetPID() throws InterruptedException, ExecutionException { final String script = "" + // "#@output Object pid\n" + // "import os\n" + // From b7d7a1b920347c60680cbaa3b7e8c4180e5d4a9f Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 29 Jun 2022 12:59:23 -0500 Subject: [PATCH 87/94] Rename this language from Python to Jython This makes it more clear how it works, and paves the way for another Python-based language soon to come. --- .../plugins/scripting/jython/JythonScriptLanguage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index 1678ebe..babad4e 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -52,7 +52,7 @@ * @author Mark Hiner * @see ScriptEngine */ -@Plugin(type = ScriptLanguage.class, name = "Python") +@Plugin(type = ScriptLanguage.class, name = "Jython") public class JythonScriptLanguage extends AdaptedScriptLanguage { @Parameter @@ -78,7 +78,7 @@ public Object decode(final Object object) { return ((PyString) object).getString(); } if (object instanceof PyObject) { - // Unwrap Python objects when they wrap Java ones. + // Unwrap Jython objects when they wrap Java ones. final PyObject pyObj = (PyObject) object; final Class javaType = pyObj.getType().getProxyType(); if (javaType != null) return pyObj.__tojava__(javaType); From 07dc8b0a5fe840c0f70669be564cfc1f926c1f12 Mon Sep 17 00:00:00 2001 From: Karl Duderstadt Date: Fri, 29 Jul 2022 13:24:43 +0200 Subject: [PATCH 88/94] Rename this language from Jython to Python (Jython) --- .../scijava/plugins/scripting/jython/JythonScriptLanguage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index babad4e..35ebfae 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -52,7 +52,7 @@ * @author Mark Hiner * @see ScriptEngine */ -@Plugin(type = ScriptLanguage.class, name = "Jython") +@Plugin(type = ScriptLanguage.class, name = "Python (Jython)") public class JythonScriptLanguage extends AdaptedScriptLanguage { @Parameter From bb91ea50f91403ddfe2a0f1d30d9c953c0cdd0ae Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 9 Mar 2023 19:58:44 -0600 Subject: [PATCH 89/94] POM: update imagej.net URLs --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 9c1ba9b..558a715 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ ctrueden Curtis Rueden - https://imagej.net/User:Rueden + https://imagej.net/people/ctrueden lead developer @@ -45,13 +45,13 @@ Johannes Schindelin - https://imagej.net/User:Schindelin + https://imagej.net/people/dscho founder dscho Mark Hiner - https://imagej.net/User:Hinerm + https://imagej.net/people/hinerm hinerm From c220853ecb56e694bfeacf71c4498e8f7ce6a2c5 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 9 Mar 2023 19:59:28 -0600 Subject: [PATCH 90/94] POM: update parent to pom-scijava 34.0.0 --- pom.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 558a715..cf62fac 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 27.0.1 + 34.0.0 @@ -92,8 +92,6 @@ Institute of Molecular Cell Biology and Genetics. sign,deploy-to-scijava - - 2.7.2 @@ -107,7 +105,6 @@ Institute of Molecular Cell Biology and Genetics. org.python jython-slim - ${jython-slim.version} From 7454ec86d0291d87a5e9c1fefb5c26b4aa078998 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 9 Mar 2023 19:59:42 -0600 Subject: [PATCH 91/94] Happy New Year 2023 --- LICENSE.txt | 4 +--- pom.xml | 4 +--- .../plugins/scripting/jython/JythonScriptLanguage.java | 4 +--- .../java/org/scijava/plugins/scripting/jython/JythonTest.java | 4 +--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 28fb714..9356d7c 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,4 @@ -Copyright (c) 2008 - 2017, Board of Regents of the University of -Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck -Institute of Molecular Cell Biology and Genetics. +Copyright (c) 2008 - 2023, SciJava developers. All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/pom.xml b/pom.xml index cf62fac..71a4bc5 100644 --- a/pom.xml +++ b/pom.xml @@ -85,9 +85,7 @@ org.scijava.plugins.scripting.jython bsd_2 - Board of Regents of the University of -Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck -Institute of Molecular Cell Biology and Genetics. + SciJava developers. **/script_templates/** diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index 35ebfae..6ec4340 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -2,9 +2,7 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. + * Copyright (C) 2008 - 2023 SciJava developers. * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java index fa9d1cd..60b5877 100644 --- a/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java +++ b/src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java @@ -2,9 +2,7 @@ * #%L * JSR-223-compliant Jython scripting language plugin. * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. + * Copyright (C) 2008 - 2023 SciJava developers. * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: From 8cf8171e766ca3164f0c37062b29f7f139e8babe Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 9 Mar 2023 20:00:32 -0600 Subject: [PATCH 92/94] POM: use HTTPS for schema location URL Maven no longer supports plain HTTP for the schema location. And using HTTP now generates errors in Eclipse (and probably other IDEs). --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 71a4bc5..0237e11 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,5 @@ - + 4.0.0 From a12807d6be8137be90ad3d882ce49cf245f3677d Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 9 Mar 2023 20:02:35 -0600 Subject: [PATCH 93/94] Bump to next development cycle Signed-off-by: Curtis Rueden --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0237e11..8ef0f03 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-jython - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT SciJava Scripting: Jython JSR-223-compliant Jython scripting language plugin. From 43d5afec4005c17f39f88a6ac437828bad2cc4e5 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Tue, 26 Aug 2025 09:37:59 -0500 Subject: [PATCH 94/94] Rename script language to simply "Jython" To differentiate from true Python: https://github.com/scijava/scripting-python/ --- .../scijava/plugins/scripting/jython/JythonScriptLanguage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java index 6ec4340..8fe493a 100644 --- a/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/jython/JythonScriptLanguage.java @@ -50,7 +50,7 @@ * @author Mark Hiner * @see ScriptEngine */ -@Plugin(type = ScriptLanguage.class, name = "Python (Jython)") +@Plugin(type = ScriptLanguage.class, name = "Jython") public class JythonScriptLanguage extends AdaptedScriptLanguage { @Parameter