https://issues.apache.org/jira/browse/FELIX-2487
패치는 됐는데 릴리스는 1.8.0 때나 나올테니 프로젝트들의 iPOJO 1.6.0 마이그레이션은 미뤄야겠음..
게으른 랍형은 테스트 코드도 안 주고 스택트레이스 하나 던져놓고 패치해달라고 징징..
올리는 김에 잉여 Wish도 같이 올려봤음..
iPOJO 만세 (..)
----
임시 코드
String code = "print 'hello xeraph'";
CompilerFlags flags = Py.getCompilerFlags();
ByteArrayOutputStream os = new ByteArrayOutputStream();
mod node = ParserFacade.parse(code, CompileMode.exec, "<string>", Py.getCompilerFlags());
Module.compile(node, os, "X", "<>", false, false, Py.getCompilerFlags());
byte[] buffer = os.toByteArray();
Class<PyRunnable> clazz = (Class<PyRunnable>) BytecodeLoader.makeClass("X", null, buffer);
Constructor<PyRunnable> constructor = clazz.getConstructor(new Class[] { String.class });
PyRunnable r = constructor.newInstance("X");
PythonInterpreter i = new PythonInterpreter();
i.exec(r.getMain());
문제는 인터랙티브 쉘 모드에서 자연스럽게 bytecode를 뽑아낼 방법이 없고 좀 인위적인 티가 나야 된다는건데.. 없는 것보다는 나을까 아니면 그냥 순수 OSGi 서비스를 알아서 만들게 할까 아니면 적절한 helper로 땜방칠까..
일단 이건 GG..
태그 : iPOJO




덧글