Skip to content

Commit bd85b9f

Browse files
committed
Update Appose to java 0.9.0 + python 0.7.2
1 parent 943cdfe commit bd85b9f

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
<!-- NB: Deploy releases to the SciJava Maven repository. -->
8989
<releaseProfiles>sign,deploy-to-scijava</releaseProfiles>
9090

91-
<appose.version>0.3.0</appose.version>
91+
<appose.version>0.9.0</appose.version>
9292
</properties>
9393

9494
<dependencies>

src/main/java/org/scijava/plugins/scripting/python/OptionsPython.java

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ public class OptionsPython extends OptionsPlugin {
6464

6565
// -- Dependency constants and fields --
6666
private static final String DEFAULT_PYIMAGEJ = "pyimagej>=1.7.0";
67-
private static final String DEFAULT_APPOSE_PYTHON =
68-
"git+https://github.com/apposed/appose-python.git@efe6dadb2242ca45820fcbb7aeea2096f99f9cb2";
67+
private static final String DEFAULT_APPOSE = "appose>=0.7.2";
6968

7069
@Parameter
7170
private AppService appService;
@@ -101,7 +100,7 @@ public class OptionsPython extends OptionsPlugin {
101100

102101
// These hold the parsed or user-specified values, or null if not found
103102
private String pyimagejDependency;
104-
private String apposePythonDependency;
103+
private String apposeDependency;
105104

106105
private boolean initialPythonMode = false;
107106
private String initialCondaDependencies;
@@ -189,9 +188,9 @@ public void load() {
189188
condaDependencies = "";
190189
pipDependencies = "";
191190
pyimagejDependency = null;
192-
apposePythonDependency = null;
191+
apposeDependency = null;
193192
java.util.Set<String> pipBlacklist = new java.util.HashSet<>();
194-
pipBlacklist.add("appose-python");
193+
pipBlacklist.add("appose");
195194
pipBlacklist.add("pyimagej");
196195
File envFile = getEnvironmentYamlFile();
197196
if (envFile.exists()) {
@@ -223,8 +222,7 @@ public void load() {
223222
if (inPip && trimmed.startsWith("- ")) {
224223
String pipDep = trimmed.substring(2).trim();
225224
if (pipDep.startsWith("pyimagej")) pyimagejDependency = pipDep;
226-
else if (pipDep.contains("appose-python")) apposePythonDependency =
227-
pipDep;
225+
else if (pipDep.contains("appose")) apposeDependency = pipDep;
228226
else {
229227
boolean blacklisted = false;
230228
for (String bad : pipBlacklist) {
@@ -351,25 +349,25 @@ private File writeEnvironmentYaml() {
351349
String trimmed = dep.trim();
352350
if (!trimmed.isEmpty()) {
353351
if (trimmed.startsWith("pyimagej")) foundPyimagej = true;
354-
if (trimmed.contains("appose-python")) foundAppose = true;
352+
if (trimmed.contains("appose")) foundAppose = true;
355353
yml.append(" - ").append(trimmed).append("\n");
356354
}
357355
}
358356
// Append pyimagej if not found
359357
if (!foundPyimagej) {
360-
String pyimagej = pyimagejDependency != null ? pyimagejDependency
361-
: DEFAULT_PYIMAGEJ;
358+
String pyimagej = pyimagejDependency != null ?
359+
pyimagejDependency : DEFAULT_PYIMAGEJ;
362360
yml.append(" - ").append(pyimagej).append("\n");
363361
}
364-
// Append appose-python if not found
362+
// Append appose if not found
365363
if (!foundAppose) {
366-
String apposePython = apposePythonDependency != null
367-
? apposePythonDependency : DEFAULT_APPOSE_PYTHON;
368-
yml.append(" - ").append(apposePython).append("\n");
364+
String appose = apposeDependency != null
365+
? apposeDependency : DEFAULT_APPOSE;
366+
yml.append(" - ").append(appose).append("\n");
369367
}
370368
java.nio.file.Files.write(envFile.toPath(), yml.toString().getBytes());
371369
pyimagejDependency = null;
372-
apposePythonDependency = null;
370+
apposeDependency = null;
373371
}
374372
catch (Exception e) {
375373
log.debug("Could not write environment.yml: " + e.getMessage());

src/main/java/org/scijava/plugins/scripting/python/RebuildEnvironment.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ public void run() {
128128
if (targetDir.exists()) targetDir.renameTo(backupDir);
129129
// Build the new environment.
130130
try {
131-
Builder builder = Appose.file(environmentYaml, "environment.yml")
131+
Builder builder = Appose.mamba()
132+
.file(environmentYaml.getAbsolutePath())
133+
.scheme("environment.yml")
134+
.base(targetDir)
132135
.subscribeOutput(this::reportMsg).subscribeError(this::reportErr)
133136
.subscribeProgress((msg, cur, max) -> Splash.update(msg, (double) cur /
134137
max));
@@ -137,7 +140,7 @@ public void run() {
137140
System.err.println();
138141
log.info("Building Python environment");
139142
Splash.show();
140-
builder.build(targetDir);
143+
builder.build();
141144
// Notify user of success
142145
if (uiService != null) {
143146
uiService.showDialog(

0 commit comments

Comments
 (0)