org.python.util

Class JythoncAntTask

public class JythoncAntTask extends 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
PathcreateClasspath()
Add a classpath.
voidexecute()
Exectute the compiler.
StringgetCompilerOptions()
get the compiler option, null if none.
FilegetJythoncPY()
Get the path to the jython compiler file (in python).
FilegetPythonHome()
Get the path to the jython home (or python home)
voidsetAddpackages(String aValue)
Include Java dependencies from this list of packages.
voidsetAll(boolean aValue)
Include all of the Jython libraries (everything in core + compiler and parser).
voidsetArgs(String aValue)
sets some additional args to send to jythonc.
voidsetBean(File aJarFileBean)
Compile into jarfile, including the correct manifest for the bean.
voidsetClasspath(Path aClasspath)
Sets the classpath field.
voidsetCompiler(String aCompiler)
Set the compiler.
voidsetCompileropts(String aValue)
Options passed directly to the Java compiler.
voidsetCore(boolean aValue)
Include the core Jython libraries (about 130K).
voidsetDeep(boolean aValue)
Compile all Python dependencies of the module.
voidsetDestdir(File aFile)
Home for the destination (build).
voidsetFalsenames(String aValue)
A comma-separated list of names that are always false.
voidsetHome(File aFile)
Jython home directory.
voidsetJar(File aJarFile)
Specifies a .jar file to create and put the results of the freeze into.
voidsetJythoncpy(File aValue)
Change the default Python compiler.
voidsetPackage(String aString)
Put all compiled code into the named Java package.
voidsetSkip(String aValue)
Don't include any of these modules in compilation.
voidsetSrcdir(File aFile)
Home for the source.
voidsetWorkdir(File aValue)
Specify the working directory where the generated Java source code is placed.

Constructor Detail

JythoncAntTask

public JythoncAntTask()
constructor set up the search pattern

Method Detail

createClasspath

public Path createClasspath()
Add a classpath. Used to handle the nested classpath element.

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

execute

public void execute()
Exectute the compiler.

getCompilerOptions

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

getJythoncPY

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

getPythonHome

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

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.

setAll

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

setArgs

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

setBean

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

setClasspath

public void setClasspath(Path aClasspath)
Sets the classpath field.

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

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.

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.

setDeep

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

setDestdir

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

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.

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.

setJythoncpy

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

setPackage

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

Parameters: aString the packake name.

setSkip

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

setSrcdir

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

setWorkdir

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