Hi there,

if no one objects I would apply the changes to the Jython engine that
Sonny To suggested on 2006-10-26 18:28 GMT+1 (enclosed) by this coming
weekend.

While at this issue: how about setting up a recurrent task which will
create a new "nightly build" whenever (or every day) a file gets
changed. This way we still would have the central Apache download-area
for allowing users/developers to get at an unofficial "latest" build.

Regards,

---rony



----------- cut here ------------
thanks for quick response. here is the new diff without my own
formatting. I use eclipse and have it auto format to my own style.


On 10/16/06, Rony G. Flatscher <[EMAIL PROTECTED]> wrote:
> Quoting Sonny To <[EMAIL PROTECTED]>:
>
> > Yes I did track the problem. Attached is  the diff for
> JythonEngine.java
> > summar of change:
> >
> > 1) I've added propertyChange method to set the ClassLoader for jython
> > 2) modify execute method to call
> > PySystemState.add_package(packageName) when there's a from packageName
> > import className in python script
> >
> > When can this get incoporated? I dont want to maintain my own private
> > subversion repository to keep track of the these minor bug fixes which
> > is what im currently doing.
>
> Great!
>
> Please supply a unified diff which ignores the change in whitespaces
> (you seem to have reformatted
> using spaces) such that the "true" (only those lines that got
> changed/added/deleted ignoring white
> space formatting) diff will be generated, something like:
>
>     diff -wu newFile originalFile
>
> Having your unified diff hanging out here a few days will allow
> interested parties to see the
> intended changes and comment, if they see a need to do so.
>
> Regards,
>
> ---rony
>
> P.S.: Personally, I will be back home by Friday (but would be
> interested to see the diffs).
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
------------------------------------------------------------------------

--- JythonEngine.java   2006-10-17 00:28:37.000000000 +0800
+++ 
/home/son/download/tmp/bsf-2.4.0/src/org/apache/bsf/engines/jython/JythonEngine.java
        2006-10-06 23:53:00.000000000 +0800
@@ -16,11 +16,8 @@
 
 package org.apache.bsf.engines.jython;
 
-import java.beans.PropertyChangeEvent;
 import java.io.ByteArrayInputStream;
 import java.util.Vector;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 import org.apache.bsf.BSFDeclaredBean;
 import org.apache.bsf.BSFException;
@@ -31,7 +28,6 @@
 import org.python.core.PyException;
 import org.python.core.PyJavaInstance;
 import org.python.core.PyObject;
-import org.python.core.PySystemState;
 import org.python.util.InteractiveInterpreter;
 
 /**
@@ -45,7 +41,6 @@
 
 public class JythonEngine extends BSFEngineImpl {
   BSFPythonInterpreter interp;
-  private final static Pattern fromRegExp = Pattern.compile("from ([.^\\S]*)");
   
   /**
    * call the named method of the given object.
@@ -146,13 +141,7 @@
   public void exec (String source, int lineNo, int columnNo,
                    Object script) throws BSFException {
        try {
-         String scriptString = script.toString();
-         Matcher matcher = fromRegExp.matcher(scriptString);
-         while (matcher.find()) {
-                 String packageName = matcher.group(1);
-                 PySystemState.add_package(packageName);
-         }
-         interp.exec (byteify(scriptString));
+         interp.exec (byteify(script.toString ()));
        } catch (PyException e) {
          throw new BSFException (BSFException.REASON_EXECUTION_ERROR,
                              "exception from Jython:\n" + e, e);
@@ -252,15 +241,4 @@
           }
       }
   }
-
-
-  public void propertyChange(PropertyChangeEvent e) {
-         super.propertyChange(e);
-         String name = e.getPropertyName();
-      Object value = e.getNewValue();
-      if (name.equals("classLoader")) {
-               Py.getSystemState().setClassLoader((ClassLoader) value);
-      }
-      
-  }
 }

------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Reply via email to