[ 
https://issues.apache.org/jira/browse/SLING-835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12712523#action_12712523
 ] 

Felix Meschberger commented on SLING-835:
-----------------------------------------

Currently the PythonScriptEngineFactory is set up through the standard JSR-223 
mechanims listing the factory class in the 
META-INF/services/javax.scripting.ScriptEngineFactory file. This way, it is not 
possilbe to inject configuration.

The easiest to inject configuration is probably to make the 
PythonScriptEngineFactory a Service Component


   @scr.component...
   @scr.service...

Then we could define the python.home property as:

   @scr.property name="python.home"

I would not set an explicit default value, but rather in the 
activate(ComponentContext ctx) method default the python.home value to a folder 
inside the bundle's data dir:

    File defaultHome = ctx.getBundleContext().getDataDir("python");

The default properties would not come from the system but from 
ComponentContext.getProperties() - this would then also automatically include 
the python.home property, you just would have to make sure it is set.

> Python: python.home must be set
> -------------------------------
>
>                 Key: SLING-835
>                 URL: https://issues.apache.org/jira/browse/SLING-835
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Felix Meschberger
>
> It seems that currently the python.home property is not set for the 
> PythonInterpreter, which causes the cachedir containing some Java Library 
> stuff caches to be created in the current working directory.
> I think, the PythonScriptEngineFactory should setup the PythonInterpreter 
> with correct setup information by calling the static 
> PythonInterpreter.initialize method before creating the first 
> PythonScriptEngine instance.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to