diff --git a/pom.xml b/pom.xml index 232859d8ac27e777638d63a52ffa89b1d6cd7b4a..0ba50ee8df37864cba9cef9c444edffa184f994d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,10 +6,10 @@ <!-- Inherited Icy Parent POM --> <parent> + <artifactId>pom-icy</artifactId> <groupId>org.bioimageanalysis.icy</groupId> - <artifactId>parent-pom-plugin</artifactId> - <version>1.0.5</version> - </parent> + <version>2.0.0</version> + </parent> <!-- Project Information --> <artifactId>icy-jep</artifactId> @@ -19,7 +19,7 @@ <name>JEP - Java Embedded Python fot Icy</name> <description>Jep embeds CPython in Java through JNI. Fork to include the library in Icy.</description> - <url></url> + <url>https://icy.bioimageanalysis.org/plugin/jep-java-embedded-python/</url> <inceptionYear>2022</inceptionYear> <organization> @@ -74,35 +74,21 @@ </properties> - <!-- Project build configuration --> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>${project.artifactId}-fetch</id> - <goals> - <goal>unpack-dependencies</goal> - </goals> - <configuration> - <includeArtifactIds>autocomplete</includeArtifactIds> - <outputDirectory>${project.build.outputDirectory}</outputDirectory> - <stripVersion>true</stripVersion> - <excludeTransitive>true</excludeTransitive> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> + <profiles> + <profile> + <id>icy-plugin-extract-library</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + </profile> + </profiles> <!-- List of project's dependencies --> <dependencies> <dependency> <groupId>org.bioimageanalysis.icy</groupId> <artifactId>icy-kernel</artifactId> + <version>${icy-kernel.version}</version> </dependency> <dependency> diff --git a/src/main/java/plugins/atournay/jep/JepPlugin.java b/src/main/java/plugins/atournay/jep/JepPlugin.java index 143506fedfead7b6f6f2080c0bec47cbc34b528c..e4e08f4e60bf8a71d2dbb7ebe0d3556cce174d3a 100644 --- a/src/main/java/plugins/atournay/jep/JepPlugin.java +++ b/src/main/java/plugins/atournay/jep/JepPlugin.java @@ -1,6 +1,5 @@ package plugins.atournay.jep; -import com.drew.lang.annotations.NotNull; import icy.plugin.abstract_.Plugin; import icy.plugin.interface_.PluginLibrary; @@ -25,7 +24,7 @@ public class JepPlugin extends Plugin implements PluginLibrary { * @param path The path to test * @return The result if the String is really a path (compatible Windows, MacOS & Linux) */ - public boolean isPath(@NotNull String path) { + public boolean isPath(String path) { if (Pattern.compile("([A-Za-z]:|[/\\\\])+.(\\w)+.*").matcher(path).find()) { return true; } diff --git a/src/main/java/plugins/atournay/jep/JepUtils.java b/src/main/java/plugins/atournay/jep/JepUtils.java index f92ee59bc6d451b0d18c7e14026cf12da1a5d7c2..b68bcf9c0561e69438b6316b94019d34ec5c644f 100644 --- a/src/main/java/plugins/atournay/jep/JepUtils.java +++ b/src/main/java/plugins/atournay/jep/JepUtils.java @@ -1,6 +1,5 @@ package plugins.atournay.jep; -import com.drew.lang.annotations.NotNull; import jep.*; import java.io.File; @@ -30,7 +29,7 @@ public class JepUtils { * @param sitePackagesPath Path to the site-packages directory * @return Path to JEP */ - public String findJepLib(@NotNull String sitePackagesPath) { + public String findJepLib(String sitePackagesPath) { String jetPath = ""; File jepDir = new File(sitePackagesPath, "jep"); @@ -58,7 +57,7 @@ public class JepUtils { * @param jepPath Path the JEP execution file (libjep.(so|jnilib|ddl)) * @param pythonRoot Path to the Python root directory */ - public void setJepPath(@NotNull String jepPath, @NotNull String pythonRoot) throws JepException { + public void setJepPath(String jepPath, String pythonRoot) throws JepException { setJepConfig(new JepConfig()); getJepConfig().setClassEnquirer(new CustomClassEnquirer()); @@ -106,7 +105,7 @@ public class JepUtils { * @param jepConfig JEP configurations {@link jep.JepConfig} and example at {@link plugins.atournay.jep.CustomClassEnquirer} * @return Python interpreter to execute some Python commands, retrieve values, etc... */ - public SubInterpreter openSubPython(@NotNull JepConfig jepConfig) { + public SubInterpreter openSubPython(JepConfig jepConfig) { return new SubInterpreter(jepConfig); } @@ -125,7 +124,7 @@ public class JepUtils { return jepConfig; } - private void setJepConfig(@NotNull JepConfig newJepConfig) { + private void setJepConfig(JepConfig newJepConfig) { this.jepConfig = newJepConfig; } @@ -133,7 +132,7 @@ public class JepUtils { return jepInterpreter; } - private void setJepInterpreter(@NotNull Interpreter jepInterpreter) { + private void setJepInterpreter(Interpreter jepInterpreter) { this.jepInterpreter = jepInterpreter; } } diff --git a/src/main/java/plugins/atournay/jep/PythonUtils.java b/src/main/java/plugins/atournay/jep/PythonUtils.java index b355c017561ffe47b47bd644a869629382b3f3b5..476a1493211fe398a578b01b7938b6d82709857e 100644 --- a/src/main/java/plugins/atournay/jep/PythonUtils.java +++ b/src/main/java/plugins/atournay/jep/PythonUtils.java @@ -1,7 +1,5 @@ package plugins.atournay.jep; -import com.drew.lang.annotations.NotNull; - import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -76,7 +74,7 @@ public class PythonUtils { * @param isDirectory Set if the path is ending by a directory (true) or a file (false) * @return The full path of the Python execution file */ - public String findPythonExecutable(@NotNull String path, @NotNull boolean isDirectory) { + public String findPythonExecutable(String path, boolean isDirectory) { if (isDirectory) { File[] pythonFiles = new File(path).listFiles((file, name) -> name.equals("bin") && file.isDirectory()); @@ -106,7 +104,7 @@ public class PythonUtils { * @param pythonExecutionPath Path to the Python home directory * @return The path to the site-packages directory */ - public String setSitePackagesDirectory(@NotNull String pythonExecutionPath) { + public String setSitePackagesDirectory(String pythonExecutionPath) { String terminalLine; String[] command = new String[]{pythonExecutionPath, "-c", "import sys; print([p for p in sys.path if p.endswith(\"site-packages\")])"}; String sitePackagesPath = "";