Skip to content

Commit

Permalink
fix issues with np and sub interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Jun 9, 2022
1 parent 7159848 commit 40ddbb4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/main/java/xyz/wagyourtail/jsmacros/jep/config/JEPConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,19 @@
import xyz.wagyourtail.jsmacros.core.config.OptionType;
import xyz.wagyourtail.jsmacros.jep.client.JsMacrosJEP;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class JEPConfig {
@Option(translationKey = "jsmacrosjep.sharedpath", group = {"jsmacros.settings.languages", "jsmacrosjep.settings.languages.jep"}, setter = "setPath", type = @OptionType(value = "file", options = "topLevel=MC"))
public String path = "./jep.dll";


@Option(translationKey = "jsmacrosjep.sharedlibs", group = {"jsmacros.settings.languages", "jsmacrosjep.settings.languages.jep"})
public String sharedLibs = "numpy";


public void setPath(String path) {
this.path = path;
JsMacrosJEP.addSharedLibrary(path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import xyz.wagyourtail.jsmacros.core.language.BaseWrappedException;
import xyz.wagyourtail.jsmacros.core.language.EventContainer;
import xyz.wagyourtail.jsmacros.core.library.BaseLibrary;
import xyz.wagyourtail.jsmacros.jep.config.JEPConfig;

import java.io.File;
import java.util.Arrays;
Expand All @@ -25,7 +26,7 @@ public JEPLanguageDefinition(String extension, Core runner) {
}

public static SubInterpreter createSubInterpreter(File folder) {
return new JepConfig().addIncludePaths(folder.getAbsolutePath()).redirectStdout(System.out).redirectStdErr(System.err).createSubInterpreter();
return new JepConfig().addSharedModules(Core.getInstance().config.getOptions(JEPConfig.class).sharedLibs.split("[\\s,]")).addIncludePaths(folder.getAbsolutePath()).redirectStdout(System.out).redirectStdErr(System.err).createSubInterpreter();
}

protected void execContext(BaseScriptContext<SubInterpreter> ctx, Executor exec) throws Exception {
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/assets/jsmacrosjep/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"jsmacrosjep.settings.languages.jep": "JEP",
"jsmacrosjep.sharedpath": "Shared Library Path"
"jsmacrosjep.sharedpath": "Shared Library Path",
"jsmacrosjep.sharedlibs": "Shared Libraries"
}

0 comments on commit 40ddbb4

Please sign in to comment.