org.python.util
Class JythoncAntTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.apache.tools.ant.taskdefs.MatchingTask
              extended by org.python.util.JythoncAntTask
All Implemented Interfaces:
Cloneable, org.apache.tools.ant.types.selectors.SelectorContainer

public class JythoncAntTask
extends org.apache.tools.ant.taskdefs.MatchingTask

Jythonc is a Python compiler into Java Bytecode. So you can call your python code from Java, and call you java code from Python, create bean, servlet...

The task is a directory based task, so attributes like includes="*.py" and excludes="broken.py" can be used to control the files pulled in. By default, all *.py files from the project folder down are included in the command.

Version:
1.0
Author:
Cyrille Morvan - cmorvan@ingenosya.com - Ingenosya France

Constructor Summary
JythoncAntTask()
          constructor set up the search pattern
 
Method Summary
 org.apache.tools.ant.types.Path createClasspath()
          Add a classpath.
 void execute()
          Exectute the compiler.
 String getCompilerOptions()
          get the compiler option, null if none.
 File getJythoncPY()
          Get the path to the jython compiler file (in python).
 File getPythonHome()
          Get the path to the jython home (or python home)
 void setAddpackages(String aValue)
          Include Java dependencies from this list of packages.
 void setAll(boolean aValue)
          Include all of the Jython libraries (everything in core + compiler and parser).
 void setArgs(String aValue)
          sets some additional args to send to jythonc.
 void setBean(File aJarFileBean)
          Compile into jarfile, including the correct manifest for the bean.
 void setClasspath(org.apache.tools.ant.types.Path aClasspath)
          Sets the classpath field.
 void setCompiler(String aCompiler)
          Set the compiler.
 void setCompileropts(String aValue)
          Options passed directly to the Java compiler.
 void setCore(boolean aValue)
          Include the core Jython libraries (about 130K).
 void setDeep(boolean aValue)
          Compile all Python dependencies of the module.
 void setDestdir(File aFile)
          Home for the destination (build).
 void setFalsenames(String aValue)
          A comma-separated list of names that are always false.
 void setHome(File aFile)
          Jython home directory.
 void setJar(File aJarFile)
          Specifies a .jar file to create and put the results of the freeze into.
 void setJythoncpy(File aValue)
          Change the default Python compiler.
 void setPackage(String aString)
          Put all compiled code into the named Java package.
 void setSkip(String aValue)
          Don't include any of these modules in compilation.
 void setSrcdir(File aFile)
          Home for the source.
 void setWorkdir(File aValue)
          Specify the working directory where the generated Java source code is placed.
 
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, init, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JythoncAntTask

public JythoncAntTask()
constructor set up the search pattern

Method Detail

createClasspath

public org.apache.tools.ant.types.Path createClasspath()
Add a classpath. Used to handle the nested classpath element.

Returns:
A Path object representing the classpath to be used.

setClasspath

public void setClasspath(org.apache.tools.ant.types.Path aClasspath)
Sets the classpath field.

Parameters:
aClasspath - A Path object representing the "classpath" attribute.

setPackage

public void setPackage(String aString)
Put all compiled code into the named Java package.

Parameters:
aString - the packake name.

setJar

public void setJar(File aJarFile)
Specifies a .jar file to create and put the results of the freeze into. Set the deep option to true.


setCore

public void setCore(boolean aValue)
Include the core Jython libraries (about 130K). Needed for applets since Netscape doesn't yet support multiple archives. Set the deep option to true.


setAll

public void setAll(boolean aValue)
Include all of the Jython libraries (everything in core + compiler and parser). Set the deep option to true.


setBean

public void setBean(File aJarFileBean)
Compile into jarfile, including the correct manifest for the bean.


setSkip

public void setSkip(String aValue)
Don't include any of these modules in compilation. This is a comma-separated list of modules.


setDeep

public void setDeep(boolean aValue)
Compile all Python dependencies of the module. This is used for creating applets.


setAddpackages

public void setAddpackages(String aValue)
Include Java dependencies from this list of packages. Default is org.python.modules and org.apache.oro.text.regex.


setWorkdir

public void setWorkdir(File aValue)
Specify the working directory where the generated Java source code is placed. Default is "./jpywork"


setCompiler

public void setCompiler(String aCompiler)
Set the compiler.


setCompileropts

public void setCompileropts(String aValue)
Options passed directly to the Java compiler. Alternatively, you can set the property python.jythonc.compileropts in the registry.


setFalsenames

public void setFalsenames(String aValue)
A comma-separated list of names that are always false. Can be used to short-circuit if clauses.


setHome

public void setHome(File aFile)
Jython home directory.


setSrcdir

public void setSrcdir(File aFile)
Home for the source.


setDestdir

public void setDestdir(File aFile)
Home for the destination (build).


setJythoncpy

public void setJythoncpy(File aValue)
Change the default Python compiler.


setArgs

public void setArgs(String aValue)
sets some additional args to send to jythonc.


getCompilerOptions

public String getCompilerOptions()
get the compiler option, null if none.


getPythonHome

public File getPythonHome()
Get the path to the jython home (or python home)


getJythoncPY

public File getJythoncPY()
Get the path to the jython compiler file (in python).


execute

public void execute()
Exectute the compiler.

Overrides:
execute in class org.apache.tools.ant.Task


Jython homepage