1 package org.python.modules; 3 4 import org.python.core.*; 5 6 public class os implements ClassDictInit { 7 public static String [] __depends__ = new String [] {"javaos", }; 8 9 11 public static void classDictInit(PyObject dict) { 12 13 15 PyTuple all = new PyTuple(new PyString[] { Py.newString('*') }); 16 PyObject module = __builtin__.__import__("javaos", null, null, all); 17 18 PyObject names = module.__dir__(); 19 PyObject name; 20 for (int i = 0; (name=names.__finditem__(i)) != null; i++) { 21 String sname = name.toString().intern(); 22 dict.__setitem__(name, module.__getattr__(sname)); 23 } 24 25 String prefix = Py.getSystemState().prefix; 26 if (prefix != null) { 27 String libdir = prefix + "/Lib/javaos.py"; 28 dict.__setitem__("__file__", new PyString(libdir)); 29 } 30 } 31 } 32 | Popular Tags |