1 package org.python.modules; 3 4 import org.python.core.*; 5 import java.io.File ; 6 7 public class py_compile { 8 public static PyList __all__ = new PyList(new PyString[] { 9 new PyString("compile") 10 }); 11 12 13 public static void compile(String filename, String cfile) { 14 compile(filename, cfile, null); 15 } 16 17 public static void compile(String filename) { 18 compile(filename, null, null); 19 } 20 21 public static void compile(String filename, String cfile, String dfile) { 22 File file = new File (filename); 23 String name = file.getName(); 24 int dot = name.lastIndexOf('.'); 25 if (dot != -1) { 26 name = name.substring(0, dot); 27 } 28 org.python.core.imp.compileSource(name, file, dfile, cfile); 29 } 30 } 31 | Popular Tags |