Example #1
0
import support_config as cfg

from java.io import File

TESTDIR = "test386jar"
JYTHON_DEV_JAR = "jython-dev.jar"
TEST_PY_NAME = TESTDIR +"/test386called.py"

def checkTestDir():
  if not os.path.exists(TESTDIR):
    raise AssertionError, TESTDIR + " does not exist"
  if not os.path.exists(TEST_PY_NAME):
    raise AssertionError, TEST_PY_NAME + " does not exist"
    
# create a jython standalone jar file:
# add the contents of jython-dev.jar and /Lib files to a new jython-dev.jar
def mkjar():
  jarFile = File(TESTDIR, JYTHON_DEV_JAR)
  jarPacker = support.JarPacker(jarFile)
  jarPacker.addJarFile(File(cfg.jython_home + "/%s" % JYTHON_DEV_JAR))
  jarPacker.addDirectory(File(cfg.jython_home + "/Lib"))
  jarPacker.close()
  return jarFile


checkTestDir()
mkjar()
jarFileName = "%s/%s" % (TESTDIR, JYTHON_DEV_JAR)
support.runJavaJar(jarFileName, TEST_PY_NAME)
Example #2
0
from java.io import File

TESTDIR = "test386jar"
JYTHON_DEV_JAR = "jython-dev.jar"
TEST_PY_NAME = TESTDIR + "/test386called.py"


def checkTestDir():
    if not os.path.exists(TESTDIR):
        raise AssertionError, TESTDIR + " does not exist"
    if not os.path.exists(TEST_PY_NAME):
        raise AssertionError, TEST_PY_NAME + " does not exist"


# create a jython standalone jar file:
# add the contents of jython-dev.jar and /Lib files to a new jython-dev.jar
def mkjar():
    jarFile = File(TESTDIR, JYTHON_DEV_JAR)
    jarPacker = support.JarPacker(jarFile)
    jarPacker.addJarFile(File(cfg.jython_home + "/%s" % JYTHON_DEV_JAR))
    jarPacker.addDirectory(File(cfg.jython_home + "/Lib"))
    jarPacker.close()
    return jarFile


checkTestDir()
mkjar()
jarFileName = "%s/%s" % (TESTDIR, JYTHON_DEV_JAR)
support.runJavaJar(jarFileName, TEST_PY_NAME)
Example #3
0
# add the contents of jython-dev.jar and /Lib files to a new jython-dev.jar
def mkJythonJar():
  jarFile = File(TESTDIR, JYTHON_DEV_JAR)
  jarPacker = support.JarPacker(jarFile)
  jarPacker.addJarFile(File(cfg.jython_home + "/%s" % JYTHON_DEV_JAR))
  jarPacker.addDirectory(File(cfg.jython_home + "/Lib"))
  jarPacker.close()
  return jarFile
  
# make a java class calling jython main
def mkJavaClass():
  support.compileJava("%s/%s.java" % (TESTDIR, CLAZZ))

# create a runnable jar file with a manifest referring to jython-dev.jar
def mkRunJar():
  jarFile = File(TESTDIR, RUN_JAR)
  manifestFile = File(TESTDIR, MANIFEST)
  jarPacker = support.JarPacker(jarFile)
  jarPacker.addManifestFile(manifestFile)
  jarPacker.addFile(File(TESTDIR, CLAZZ+".class"), TESTDIR)
  jarPacker.close()
                       
                    

checkTestDir()
mkJythonJar()
mkJavaClass()
mkRunJar()
jarFileName = "%s/%s" % (TESTDIR, RUN_JAR)
support.runJavaJar(jarFileName)
Example #4
0
def mkJythonJar():
    jarFile = File(TESTDIR, JYTHON_JAR)
    jarPacker = support.JarPacker(jarFile)
    jarPacker.addJarFile(File(cfg.jython_home + "/%s" % JYTHON_JAR))
    jarPacker.addDirectory(File(cfg.jython_home + "/Lib"))
    jarPacker.close()
    return jarFile


# make a java class calling jython main
def mkJavaClass():
    support.compileJava("%s/%s.java" % (TESTDIR, CLAZZ))


# create a runnable jar file with a manifest referring to jython.jar
def mkRunJar():
    jarFile = File(TESTDIR, RUN_JAR)
    manifestFile = File(TESTDIR, MANIFEST)
    jarPacker = support.JarPacker(jarFile)
    jarPacker.addManifestFile(manifestFile)
    jarPacker.addFile(File(TESTDIR, CLAZZ + ".class"), TESTDIR)
    jarPacker.close()


checkTestDir()
mkJythonJar()
mkJavaClass()
mkRunJar()
jarFileName = "%s/%s" % (TESTDIR, RUN_JAR)
support.runJavaJar(jarFileName)