Jython support in Schmant

Revision History
Revision 1.0.22010.02.16

Table of Contents

Running
Environment
Miscellaneous notes
Restrictions
See also

To enable Jython support, put the Jython JARs on the classpath when running the build script. Jython can be downloaded from the Jython site.

The python.home system property must be set to the path of a directory where Jython can put runtime files. A temporary directory such as /tmp on a Unix system works fine. If security is an issue, use a directory that can only be written to by the user running the Schmant script.

Before running a Jython script, Schmant prepares the scripting environment by running the prepare.py script. It imports common classes, enables the org.schmant.task.base task package and defines the following functions:

debug(s)

Write a debug message to the current Report.

info(s)

Write an information message to the current Report.

warn(s)

Write a warning message to the current Report.

error(s)

Write an error message to the current Report.

fail(s)

Write an error message to the current Report and abort the build script execution.

importClasses(name)

Import all Java classes from the Java package name.

enableTaskPackage(name)

Enable the task package name.

All classes in the following Java packages are imported by the environment preparation script:

  • java.io

  • java.util

  • java.util.logging

  • org.entityfs

  • org.entityfs.el

  • org.entityfs.entityattrs.unix

  • org.entityfs.fs

  • org.entityfs.lock

  • org.entityfs.ostrat

  • org.entityfs.support.util

  • org.entityfs.support.util.regexp

  • org.entityfs.util

  • org.entityfs.util.cap.entity

  • org.entityfs.util.filter

  • org.entityfs.util.filter.entity

  • org.entityfs.util.filter.entity.regexp

  • org.entityfs.util.itr

  • org.entityfs.util.properties

  • org.entityfs.util.zip

  • org.schmant

  • org.schmant.arg

  • org.schmant.lang

  • org.schmant.project

  • org.schmant.project.eclipse

  • org.schmant.project.filter

  • org.schmant.project.intellij

  • org.schmant.project.java

  • org.schmant.report

  • org.schmant.run

  • org.schmant.support

  • org.schmant.support.entityfs

  • org.schmant.support.io

  • org.schmant.support.text

  • org.schmant.support.xml

  • org.schmant.task

  • org.schmant.task.template.jdk.javadoc

  • org.schmant.tpm

Using dictionaries

Jython does not seem to try to translate a dictionary to a Map when calling methods on Java objects. Use Map:s instead of dictionaries.

String concatenation

Jython does not call toString() automatically on an object when concatenating it with a string. That has to be done manually.