KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > python > modules > py_compile


1 // Copyright (c) Corporation for National Research Initiatives
2
package org.python.modules;
3
4 import org.python.core.*;
5 import java.io.File JavaDoc;
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 JavaDoc filename, String JavaDoc cfile) {
14         compile(filename, cfile, null);
15     }
16
17     public static void compile(String JavaDoc filename) {
18         compile(filename, null, null);
19     }
20
21     public static void compile(String JavaDoc filename, String JavaDoc cfile, String JavaDoc dfile) {
22         File JavaDoc file = new File JavaDoc(filename);
23         String JavaDoc 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