1 import org.python.core.*;
3 public class javapath extends java.lang.Object {
4 static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
5 static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
6 static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
8 public static class _PyInner extends PyFunctionTable implements PyRunnable {
9 private static PyObject s$0;
10 private static PyObject s$1;
11 private static PyObject s$2;
12 private static PyObject s$3;
13 private static PyObject s$4;
14 private static PyObject s$5;
15 private static PyObject s$6;
16 private static PyObject s$7;
17 private static PyObject s$8;
18 private static PyObject s$9;
19 private static PyObject i$10;
20 private static PyObject i$11;
21 private static PyObject s$12;
22 private static PyObject s$13;
23 private static PyObject s$14;
24 private static PyObject s$15;
25 private static PyObject s$16;
26 private static PyObject s$17;
27 private static PyObject s$18;
28 private static PyObject s$19;
29 private static PyObject s$20;
30 private static PyObject s$21;
31 private static PyObject s$22;
32 private static PyObject s$23;
33 private static PyObject s$24;
34 private static PyObject s$25;
35 private static PyObject s$26;
36 private static PyObject s$27;
37 private static PyObject s$28;
38 private static PyObject s$29;
39 private static PyObject s$30;
40 private static PyObject s$31;
41 private static PyObject s$32;
42 private static PyObject i$33;
43 private static PyObject s$34;
44 private static PyObject s$35;
45 private static PyObject s$36;
46 private static PyObject s$37;
47 private static PyObject s$38;
48 private static PyObject s$39;
49 private static PyObject s$40;
50 private static PyObject s$41;
51 private static PyObject s$42;
52 private static PyObject f$43;
53 private static PyObject s$44;
54 private static PyObject s$45;
55 private static PyObject s$46;
56 private static PyObject s$47;
57 private static PyObject s$48;
58 private static PyObject s$49;
59 private static PyObject s$50;
60 private static PyObject s$51;
61 private static PyFunctionTable funcTable;
62 private static PyCode c$0__tostr;
63 private static PyCode c$1_dirname;
64 private static PyCode c$2_basename;
65 private static PyCode c$3_split;
66 private static PyCode c$4_splitext;
67 private static PyCode c$5_splitdrive;
68 private static PyCode c$6_exists;
69 private static PyCode c$7_isabs;
70 private static PyCode c$8_isfile;
71 private static PyCode c$9_isdir;
72 private static PyCode c$10_join;
73 private static PyCode c$11_normcase;
74 private static PyCode c$12_commonprefix;
75 private static PyCode c$13_islink;
76 private static PyCode c$14_samefile;
77 private static PyCode c$15_ismount;
78 private static PyCode c$16_walk;
79 private static PyCode c$17_expanduser;
80 private static PyCode c$18_getuser;
81 private static PyCode c$19_gethome;
82 private static PyCode c$20_normpath;
83 private static PyCode c$21_abspath;
84 private static PyCode c$22_getsize;
85 private static PyCode c$23_getmtime;
86 private static PyCode c$24_getatime;
87 private static PyCode c$25_expandvars;
88 private static PyCode c$26_main;
89 private static void initConstants() {
90 s$0 = Py.newString("Common pathname manipulations, JDK version.\012\012Instead of importing this module directly, import os and refer to this\012module as os.path.\012\012");
91 s$1 = Py.newString("");
92 s$2 = Py.newString("%s() argument must be a string object, not %s");
93 s$3 = Py.newString("Return the directory component of a pathname");
94 s$4 = Py.newString("dirname");
95 s$5 = Py.newString("Return the final component of a pathname");
96 s$6 = Py.newString("basename");
97 s$7 = Py.newString("Split a pathname.\012\012 Return tuple \"(head, tail)\" where \"tail\" is everything after the\012 final slash. Either part may be empty.\012\012 ");
98 s$8 = Py.newString("split");
99 s$9 = Py.newString("Split the extension from a pathname.\012\012 Extension is everything from the last dot to the end. Return\012 \"(root, ext)\", either part may be empty.\012\012 ");
100 i$10 = Py.newInteger(0);
101 i$11 = Py.newInteger(1);
102 s$12 = Py.newString(".");
103 s$13 = Py.newString("Split a pathname into drive and path.\012\012 On JDK, drive is always empty.\012 XXX This isn't correct for JDK on DOS/Windows!\012\012 ");
104 s$14 = Py.newString("Test whether a path exists.\012\012 Returns false for broken symbolic links.\012\012 ");
105 s$15 = Py.newString("exists");
106 s$16 = Py.newString("Test whether a path is absolute");
107 s$17 = Py.newString("isabs");
108 s$18 = Py.newString("Test whether a path is a regular file");
109 s$19 = Py.newString("isfile");
110 s$20 = Py.newString("Test whether a path is a directory");
111 s$21 = Py.newString("isdir");
112 s$22 = Py.newString("Join two or more pathname components, inserting os.sep as needed");
113 s$23 = Py.newString("join");
114 s$24 = Py.newString("Normalize case of pathname.\012\012 XXX Not done right under JDK.\012\012 ");
115 s$25 = Py.newString("normcase");
116 s$26 = Py.newString("Given a list of pathnames, return the longest common leading component");
117 s$27 = Py.newString("Test whether a path is a symbolic link.\012\012 XXX This incorrectly always returns false under JDK.\012\012 ");
118 s$28 = Py.newString("Test whether two pathnames reference the same actual file");
119 s$29 = Py.newString("samefile");
120 s$30 = Py.newString("Test whether a path is a mount point.\012\012 XXX This incorrectly always returns false under JDK.\012\012 ");
121 s$31 = Py.newString("Walk a directory tree.\012\012 walk(top,func,args) calls func(arg, d, files) for each directory\012 \"d\" in the tree rooted at \"top\" (including \"top\" itself). \"files\"\012 is a list of all the files and subdirs in directory \"d\".\012\012 ");
122 s$32 = Py.newString("~");
123 i$33 = Py.newInteger(2);
124 s$34 = Py.newString("user.name");
125 s$35 = Py.newString("user.home");
126 s$36 = Py.newString("Normalize path, eliminating double slashes, etc.");
127 s$37 = Py.newString("\\");
128 s$38 = Py.newString("/");
129 s$39 = Py.newString("abspath");
130 s$40 = Py.newString("getsize");
131 s$41 = Py.newString("No such file or directory");
132 s$42 = Py.newString("getmtime");
133 f$43 = Py.newFloat(1000.0);
134 s$44 = Py.newString("getatime");
135 s$45 = Py.newString("Expand shell variables of form $var and ${var}.\012\012 Unknown variables are left unchanged.");
136 s$46 = Py.newString("$");
137 s$47 = Py.newString("_-");
138 s$48 = Py.newString("'");
139 s$49 = Py.newString("{");
140 s$50 = Py.newString("}");
141 s$51 = Py.newString("/usr/share/jython/Lib/javapath.py");
142 funcTable = new _PyInner();
143 c$0__tostr = Py.newCode(2, new String[] {"s", "method", "org"}, "/usr/share/jython/Lib/javapath.py", "_tostr", false, false, funcTable, 0, null, null, 0, 1);
144 c$1_dirname = Py.newCode(1, new String[] {"path", "result"}, "/usr/share/jython/Lib/javapath.py", "dirname", false, false, funcTable, 1, null, null, 0, 1);
145 c$2_basename = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "basename", false, false, funcTable, 2, null, null, 0, 1);
146 c$3_split = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "split", false, false, funcTable, 3, null, null, 0, 1);
147 c$4_splitext = Py.newCode(1, new String[] {"path", "i", "c", "n"}, "/usr/share/jython/Lib/javapath.py", "splitext", false, false, funcTable, 4, null, null, 0, 1);
148 c$5_splitdrive = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "splitdrive", false, false, funcTable, 5, null, null, 0, 1);
149 c$6_exists = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "exists", false, false, funcTable, 6, null, null, 0, 1);
150 c$7_isabs = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "isabs", false, false, funcTable, 7, null, null, 0, 1);
151 c$8_isfile = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "isfile", false, false, funcTable, 8, null, null, 0, 1);
152 c$9_isdir = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "isdir", false, false, funcTable, 9, null, null, 0, 1);
153 c$10_join = Py.newCode(2, new String[] {"path", "args", "a", "g", "f"}, "/usr/share/jython/Lib/javapath.py", "join", true, false, funcTable, 10, null, null, 0, 1);
154 c$11_normcase = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "normcase", false, false, funcTable, 11, null, null, 0, 1);
155 c$12_commonprefix = Py.newCode(1, new String[] {"m", "i", "item", "prefix"}, "/usr/share/jython/Lib/javapath.py", "commonprefix", false, false, funcTable, 12, null, null, 0, 1);
156 c$13_islink = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "islink", false, false, funcTable, 13, null, null, 0, 1);
157 c$14_samefile = Py.newCode(2, new String[] {"path", "path2", "f", "f2"}, "/usr/share/jython/Lib/javapath.py", "samefile", false, false, funcTable, 14, null, null, 0, 1);
158 c$15_ismount = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "ismount", false, false, funcTable, 15, null, null, 0, 1);
159 c$16_walk = Py.newCode(3, new String[] {"top", "func", "arg", "name", "names"}, "/usr/share/jython/Lib/javapath.py", "walk", false, false, funcTable, 16, null, null, 0, 1);
160 c$17_expanduser = Py.newCode(1, new String[] {"path", "c"}, "/usr/share/jython/Lib/javapath.py", "expanduser", false, false, funcTable, 17, null, null, 0, 1);
161 c$18_getuser = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/javapath.py", "getuser", false, false, funcTable, 18, null, null, 0, 1);
162 c$19_gethome = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/javapath.py", "gethome", false, false, funcTable, 19, null, null, 0, 1);
163 c$20_normpath = Py.newCode(1, new String[] {"path", "comps", "i", "pardir", "string", "slashes", "curdir", "sep"}, "/usr/share/jython/Lib/javapath.py", "normpath", false, false, funcTable, 20, null, null, 0, 1);
164 c$21_abspath = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "abspath", false, false, funcTable, 21, null, null, 0, 1);
165 c$22_getsize = Py.newCode(1, new String[] {"path", "size", "f"}, "/usr/share/jython/Lib/javapath.py", "getsize", false, false, funcTable, 22, null, null, 0, 1);
166 c$23_getmtime = Py.newCode(1, new String[] {"path", "f"}, "/usr/share/jython/Lib/javapath.py", "getmtime", false, false, funcTable, 23, null, null, 0, 1);
167 c$24_getatime = Py.newCode(1, new String[] {"path", "f"}, "/usr/share/jython/Lib/javapath.py", "getatime", false, false, funcTable, 24, null, null, 0, 1);
168 c$25_expandvars = Py.newCode(1, new String[] {"path", "varchars", "string", "index", "res", "c", "pathlen", "var"}, "/usr/share/jython/Lib/javapath.py", "expandvars", false, false, funcTable, 25, null, null, 0, 1);
169 c$26_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/javapath.py", "main", false, false, funcTable, 26, null, null, 0, 0);
173 public PyCode getMain() {
174 if (c$26_main == null) _PyInner.initConstants();
178 public PyObject call_function(int index, PyFrame frame) {
181 return _PyInner._tostr$1(frame);
183 return _PyInner.dirname$2(frame);
185 return _PyInner.basename$3(frame);
187 return _PyInner.split$4(frame);
189 return _PyInner.splitext$5(frame);
191 return _PyInner.splitdrive$6(frame);
193 return _PyInner.exists$7(frame);
195 return _PyInner.isabs$8(frame);
197 return _PyInner.isfile$9(frame);
199 return _PyInner.isdir$10(frame);
201 return _PyInner.join$11(frame);
203 return _PyInner.normcase$12(frame);
205 return _PyInner.commonprefix$13(frame);
207 return _PyInner.islink$14(frame);
209 return _PyInner.samefile$15(frame);
211 return _PyInner.ismount$16(frame);
213 return _PyInner.walk$17(frame);
215 return _PyInner.expanduser$18(frame);
217 return _PyInner.getuser$19(frame);
219 return _PyInner.gethome$20(frame);
221 return _PyInner.normpath$21(frame);
223 return _PyInner.abspath$22(frame);
225 return _PyInner.getsize$23(frame);
227 return _PyInner.getmtime$24(frame);
229 return _PyInner.getatime$25(frame);
231 return _PyInner.expandvars$26(frame);
233 return _PyInner.main$27(frame);
239 private static PyObject _tostr$1(PyFrame frame) {
240 if (frame.getglobal("isinstance").__call__(frame.getlocal(0), s$1.__getattr__("__class__")).__nonzero__()) {
241 return frame.getlocal(0);
243 frame.setlocal(2, org.python.core.imp.importOne("org", frame));
244 throw Py.makeException(frame.getglobal("TypeError"), s$2._mod(new PyTuple(new PyObject[] {frame.getlocal(1), frame.getlocal(2).__getattr__("python").__getattr__("core").__getattr__("Py").__getattr__("safeRepr").__call__(frame.getlocal(0))})));
247 private static PyObject dirname$2(PyFrame frame) {
248 /* Return the directory component of a pathname */
249 frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$4));
250 frame.setlocal(1, frame.getglobal("File").__call__(frame.getlocal(0)).invoke("getParent"));
251 if (frame.getlocal(1).__not__().__nonzero__()) {
252 if (frame.getglobal("isabs").__call__(frame.getlocal(0)).__nonzero__()) {
253 frame.setlocal(1, frame.getlocal(0));
256 frame.setlocal(1, s$1);
259 return frame.getlocal(1);
262 private static PyObject basename$3(PyFrame frame) {
263 /* Return the final component of a pathname */
264 frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$6));
265 return frame.getglobal("File").__call__(frame.getlocal(0)).invoke("getName");
268 private static PyObject split$4(PyFrame frame) {
271 Return tuple "(head, tail)" where "tail" is everything after the
272 final slash. Either part may be empty.
275 frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$8));
276 return new PyTuple(new PyObject[] {frame.getglobal("dirname").__call__(frame.getlocal(0)), frame.getglobal("basename").__call__(frame.getlocal(0))});
279 private static PyObject splitext$5(PyFrame frame) {
280 // Temporary Variables
282 PyObject t$0$PyObject, t$1$PyObject;
285 /* Split the extension from a pathname.
287 Extension is everything from the last dot to the end. Return
288 "(root, ext)", either part may be empty.
291 frame.setlocal(1, i$10);
292 frame.setlocal(3, i$11.__neg__());
294 t$1$PyObject = frame.getlocal(0);
295 while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
296 frame.setlocal(2, t$0$PyObject);
297 if (frame.getlocal(2)._eq(s$12).__nonzero__()) {
298 frame.setlocal(3, frame.getlocal(1));
300 frame.setlocal(1, frame.getlocal(1)._add(i$11));
302 if (frame.getlocal(3)._lt(i$10).__nonzero__()) {
303 return new PyTuple(new PyObject[] {frame.getlocal(0), s$1});
306 return new PyTuple(new PyObject[] {frame.getlocal(0).__getslice__(null, frame.getlocal(3), null), frame.getlocal(0).__getslice__(frame.getlocal(3), null, null)});
310 private static PyObject splitdrive$6(PyFrame frame) {
311 /* Split a pathname into drive and path.
313 On JDK, drive is always empty.
314 XXX This isn't correct for JDK on DOS/Windows!
317 return new PyTuple(new PyObject[] {s$1, frame.getlocal(0)});
320 private static PyObject exists$7(PyFrame frame) {
321 /* Test whether a path exists.
323 Returns false for broken symbolic links.
326 frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$15));
327 return frame.getglobal("File").__call__(frame.getlocal(0)).invoke("exists");
330 private static PyObject isabs$8(PyFrame frame) {
331 /* Test whether a path is absolute */
332 frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$17));
333 return frame.getglobal("File").__call__(frame.getlocal(0)).invoke("isAbsolute");
336 private static PyObject isfile$9(PyFrame frame) {
337 /* Test whether a path is a regular file */
338 frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$19));
339 return frame.getglobal("File").__call__(frame.getlocal(0)).invoke("isFile");
342 private static PyObject isdir$10(PyFrame frame) {
343 /* Test whether a path is a directory */
344 frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$21));
345 return frame.getglobal("File").__call__(frame.getlocal(0)).invoke("isDirectory");
348 private static PyObject join$11(PyFrame frame) {
349 // Temporary Variables
351 PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
354 /* Join two or more pathname components, inserting os.sep as needed */
355 frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$23));
356 frame.setlocal(4, frame.getglobal("File").__call__(frame.getlocal(0)));
358 t$1$PyObject = frame.getlocal(1);
359 while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
360 frame.setlocal(2, t$0$PyObject);
361 frame.setlocal(2, frame.getglobal("_tostr").__call__(frame.getlocal(2), s$23));
362 frame.setlocal(3, frame.getglobal("File").__call__(frame.getlocal(2)));
363 if (((t$2$PyObject = frame.getlocal(3).invoke("isAbsolute")).__nonzero__() ? t$2$PyObject : frame.getglobal("len").__call__(frame.getlocal(4).invoke("getPath"))._eq(i$10)).__nonzero__()) {
364 frame.setlocal(4, frame.getlocal(3));
367 frame.setlocal(4, frame.getglobal("File").__call__(frame.getlocal(4), frame.getlocal(2)));
370 return frame.getlocal(4).invoke("getPath");
373 private static PyObject normcase$12(PyFrame frame) {
374 /* Normalize case of pathname.
376 XXX Not done right under JDK.
379 frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$25));
380 return frame.getglobal("File").__call__(frame.getlocal(0)).invoke("getPath");
383 private static PyObject commonprefix$13(PyFrame frame) {
384 // Temporary Variables
385 int t$0$int, t$1$int;
386 PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject;
389 /* Given a list of pathnames, return the longest common leading component */
390 if (frame.getlocal(0).__not__().__nonzero__()) {
393 frame.setlocal(3, frame.getlocal(0).__getitem__(i$10));
395 t$1$PyObject = frame.getlocal(0);
396 while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
397 frame.setlocal(2, t$0$PyObject);
399 t$3$PyObject = frame.getglobal("range").__call__(frame.getglobal("len").__call__(frame.getlocal(3)));
400 while ((t$2$PyObject = t$3$PyObject.__finditem__(t$1$int++)) != null) {
401 frame.setlocal(1, t$2$PyObject);
402 if (frame.getlocal(3).__getslice__(null, frame.getlocal(1)._add(i$11), null)._ne(frame.getlocal(2).__getslice__(null, frame.getlocal(1)._add(i$11), null)).__nonzero__()) {
403 frame.setlocal(3, frame.getlocal(3).__getslice__(null, frame.getlocal(1), null));
404 if (frame.getlocal(1)._eq(i$10).__nonzero__()) {
411 return frame.getlocal(3);
414 private static PyObject islink$14(PyFrame frame) {
415 /* Test whether a path is a symbolic link.
417 XXX This incorrectly always returns false under JDK.
423 private static PyObject samefile$15(PyFrame frame) {
424 /* Test whether two pathnames reference the same actual file */
425 frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$29));
426 frame.setlocal(1, frame.getglobal("_tostr").__call__(frame.getlocal(1), s$29));
427 frame.setlocal(2, frame.getglobal("File").__call__(frame.getlocal(0)));
428 frame.setlocal(3, frame.getglobal("File").__call__(frame.getlocal(1)));
429 return frame.getlocal(2).invoke("getCanonicalPath")._eq(frame.getlocal(3).invoke("getCanonicalPath"));
432 private static PyObject ismount$16(PyFrame frame) {
433 /* Test whether a path is a mount point.
435 XXX This incorrectly always returns false under JDK.
441 private static PyObject walk$17(PyFrame frame) {
442 // Temporary Variables
444 PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
445 PyException t$0$PyException;
448 /* Walk a directory tree.
450 walk(top,func,args) calls func(arg, d, files) for each directory
451 "d" in the tree rooted at "top" (including "top" itself). "files"
452 is a list of all the files and subdirs in directory "d".
456 frame.setlocal(4, frame.getglobal("os").__getattr__("listdir").__call__(frame.getlocal(0)));
458 catch (Throwable x$0) {
459 t$0$PyException = Py.setException(x$0, frame);
460 if (Py.matchException(t$0$PyException, frame.getglobal("os").__getattr__("error"))) {
463 else throw t$0$PyException;
465 frame.getlocal(1).__call__(frame.getlocal(2), frame.getlocal(0), frame.getlocal(4));
467 t$1$PyObject = frame.getlocal(4);
468 while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
469 frame.setlocal(3, t$0$PyObject);
470 frame.setlocal(3, frame.getglobal("join").__call__(frame.getlocal(0), frame.getlocal(3)));
471 if (((t$2$PyObject = frame.getglobal("isdir").__call__(frame.getlocal(3))).__nonzero__() ? frame.getglobal("islink").__call__(frame.getlocal(3)).__not__() : t$2$PyObject).__nonzero__()) {
472 frame.getglobal("walk").__call__(frame.getlocal(3), frame.getlocal(1), frame.getlocal(2));
478 private static PyObject expanduser$18(PyFrame frame) {
479 if (frame.getlocal(0).__getslice__(null, i$11, null)._eq(s$32).__nonzero__()) {
480 frame.setlocal(1, frame.getlocal(0).__getslice__(i$11, i$33, null));
481 if (frame.getlocal(1).__not__().__nonzero__()) {
482 return frame.getglobal("gethome").__call__();
484 if (frame.getlocal(1)._eq(frame.getglobal("os").__getattr__("sep")).__nonzero__()) {
485 return frame.getglobal("File").__call__(frame.getglobal("gethome").__call__(), frame.getlocal(0).__getslice__(i$33, null, null)).invoke("getPath");
488 return frame.getlocal(0);
491 private static PyObject getuser$19(PyFrame frame) {
492 return frame.getglobal("System").__getattr__("getProperty").__call__(s$34);
495 private static PyObject gethome$20(PyFrame frame) {
496 return frame.getglobal("System").__getattr__("getProperty").__call__(s$35);
499 private static PyObject normpath$21(PyFrame frame) {
500 // Temporary Variables
501 PyObject t$0$PyObject, t$1$PyObject;
504 /* Normalize path, eliminating double slashes, etc. */
505 frame.setlocal(7, frame.getglobal("os").__getattr__("sep"));
506 if (frame.getlocal(7)._eq(s$37).__nonzero__()) {
507 frame.setlocal(0, frame.getlocal(0).invoke("replace", s$38, frame.getlocal(7)));
509 frame.setlocal(6, frame.getglobal("os").__getattr__("curdir"));
510 frame.setlocal(3, frame.getglobal("os").__getattr__("pardir"));
511 frame.setlocal(4, org.python.core.imp.importOne("string", frame));
512 frame.setlocal(5, s$1);
513 while (frame.getlocal(0).__getslice__(null, i$11, null)._eq(frame.getlocal(7)).__nonzero__()) {
514 frame.setlocal(5, frame.getlocal(5)._add(frame.getlocal(7)));
515 frame.setlocal(0, frame.getlocal(0).__getslice__(i$11, null, null));
517 frame.setlocal(1, frame.getlocal(4).__getattr__("splitfields").__call__(frame.getlocal(0), frame.getlocal(7)));
518 frame.setlocal(2, i$10);
519 while (frame.getlocal(2)._lt(frame.getglobal("len").__call__(frame.getlocal(1))).__nonzero__()) {
520 if (frame.getlocal(1).__getitem__(frame.getlocal(2))._eq(frame.getlocal(6)).__nonzero__()) {
521 frame.getlocal(1).__delitem__(frame.getlocal(2));
522 while (((t$0$PyObject = frame.getlocal(2)._lt(frame.getglobal("len").__call__(frame.getlocal(1)))).__nonzero__() ? frame.getlocal(1).__getitem__(frame.getlocal(2))._eq(s$1) : t$0$PyObject).__nonzero__()) {
523 frame.getlocal(1).__delitem__(frame.getlocal(2));
526 else if (((t$0$PyObject = ((t$1$PyObject = frame.getlocal(1).__getitem__(frame.getlocal(2))._eq(frame.getlocal(3))).__nonzero__() ? frame.getlocal(2)._gt(i$10) : t$1$PyObject)).__nonzero__() ? frame.getlocal(1).__getitem__(frame.getlocal(2)._sub(i$11))._notin(new PyTuple(new PyObject[] {s$1, frame.getlocal(3)})) : t$0$PyObject).__nonzero__()) {
527 frame.getlocal(1).__delslice__(frame.getlocal(2)._sub(i$11), frame.getlocal(2)._add(i$11), null);
528 frame.setlocal(2, frame.getlocal(2)._sub(i$11));
530 else if (((t$0$PyObject = ((t$1$PyObject = frame.getlocal(1).__getitem__(frame.getlocal(2))._eq(s$1)).__nonzero__() ? frame.getlocal(2)._gt(i$10) : t$1$PyObject)).__nonzero__() ? frame.getlocal(1).__getitem__(frame.getlocal(2)._sub(i$11))._ne(s$1) : t$0$PyObject).__nonzero__()) {
531 frame.getlocal(1).__delitem__(frame.getlocal(2));
534 frame.setlocal(2, frame.getlocal(2)._add(i$11));
537 if (((t$0$PyObject = frame.getlocal(1).__not__()).__nonzero__() ? frame.getlocal(5).__not__() : t$0$PyObject).__nonzero__()) {
538 frame.getlocal(1).invoke("append", frame.getlocal(6));
540 return frame.getlocal(5)._add(frame.getlocal(4).__getattr__("joinfields").__call__(frame.getlocal(1), frame.getlocal(7)));
543 private static PyObject abspath$22(PyFrame frame) {
544 frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$39));
545 return frame.getglobal("File").__call__(frame.getlocal(0)).invoke("getAbsolutePath");
548 private static PyObject getsize$23(PyFrame frame) {
549 // Temporary Variables
550 PyObject t$0$PyObject;
553 frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$40));
554 frame.setlocal(2, frame.getglobal("File").__call__(frame.getlocal(0)));
555 frame.setlocal(1, frame.getlocal(2).invoke("length"));
556 if (((t$0$PyObject = frame.getlocal(1)._eq(i$10)).__nonzero__() ? frame.getlocal(2).invoke("exists").__not__() : t$0$PyObject).__nonzero__()) {
557 throw Py.makeException(frame.getglobal("OSError").__call__(i$10, s$41, frame.getlocal(0)));
559 return frame.getlocal(1);
562 private static PyObject getmtime$24(PyFrame frame) {
563 frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$42));
564 frame.setlocal(1, frame.getglobal("File").__call__(frame.getlocal(0)));
565 return frame.getlocal(1).invoke("lastModified")._div(f$43);
568 private static PyObject getatime$25(PyFrame frame) {
569 frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$44));
570 frame.setlocal(1, frame.getglobal("File").__call__(frame.getlocal(0)));
571 return frame.getlocal(1).invoke("lastModified")._div(f$43);
574 private static PyObject expandvars$26(PyFrame frame) {
575 // Temporary Variables
576 PyObject t$0$PyObject;
577 PyException t$0$PyException;
580 /* Expand shell variables of form $var and ${var}.
582 Unknown variables are left unchanged. */
583 if (s$46._notin(frame.getlocal(0)).__nonzero__()) {
584 return frame.getlocal(0);
586 frame.setlocal(2, org.python.core.imp.importOne("string", frame));
587 frame.setlocal(1, frame.getlocal(2).__getattr__("letters")._add(frame.getlocal(2).__getattr__("digits"))._add(s$47));
588 frame.setlocal(4, s$1);
589 frame.setlocal(3, i$10);
590 frame.setlocal(6, frame.getglobal("len").__call__(frame.getlocal(0)));
591 while (frame.getlocal(3)._lt(frame.getlocal(6)).__nonzero__()) {
592 frame.setlocal(5, frame.getlocal(0).__getitem__(frame.getlocal(3)));
593 if (frame.getlocal(5)._eq(s$48).__nonzero__()) {
594 frame.setlocal(0, frame.getlocal(0).__getslice__(frame.getlocal(3)._add(i$11), null, null));
595 frame.setlocal(6, frame.getglobal("len").__call__(frame.getlocal(0)));
597 frame.setlocal(3, frame.getlocal(0).invoke("index", s$48));
598 frame.setlocal(4, frame.getlocal(4)._add(s$48)._add(frame.getlocal(0).__getslice__(null, frame.getlocal(3)._add(i$11), null)));
600 catch (Throwable x$0) {
601 t$0$PyException = Py.setException(x$0, frame);
602 if (Py.matchException(t$0$PyException, frame.getglobal("ValueError"))) {
603 frame.setlocal(4, frame.getlocal(4)._add(frame.getlocal(0)));
604 frame.setlocal(3, frame.getlocal(6)._sub(i$11));
606 else throw t$0$PyException;
609 else if (frame.getlocal(5)._eq(s$46).__nonzero__()) {
610 if (frame.getlocal(0).__getslice__(frame.getlocal(3)._add(i$11), frame.getlocal(3)._add(i$33), null)._eq(s$46).__nonzero__()) {
611 frame.setlocal(4, frame.getlocal(4)._add(frame.getlocal(5)));
612 frame.setlocal(3, frame.getlocal(3)._add(i$11));
614 else if (frame.getlocal(0).__getslice__(frame.getlocal(3)._add(i$11), frame.getlocal(3)._add(i$33), null)._eq(s$49).__nonzero__()) {
615 frame.setlocal(0, frame.getlocal(0).__getslice__(frame.getlocal(3)._add(i$33), null, null));
616 frame.setlocal(6, frame.getglobal("len").__call__(frame.getlocal(0)));
618 frame.setlocal(3, frame.getlocal(0).invoke("index", s$50));
619 frame.setlocal(7, frame.getlocal(0).__getslice__(null, frame.getlocal(3), null));
620 if (frame.getglobal("os").__getattr__("environ").__getattr__("has_key").__call__(frame.getlocal(7)).__nonzero__()) {
621 frame.setlocal(4, frame.getlocal(4)._add(frame.getglobal("os").__getattr__("environ").__getitem__(frame.getlocal(7))));
624 catch (Throwable x$1) {
625 t$0$PyException = Py.setException(x$1, frame);
626 if (Py.matchException(t$0$PyException, frame.getglobal("ValueError"))) {
627 frame.setlocal(4, frame.getlocal(4)._add(frame.getlocal(0)));
628 frame.setlocal(3, frame.getlocal(6)._sub(i$11));
630 else throw t$0$PyException;
634 frame.setlocal(7, s$1);
635 frame.setlocal(3, frame.getlocal(3)._add(i$11));
636 frame.setlocal(5, frame.getlocal(0).__getslice__(frame.getlocal(3), frame.getlocal(3)._add(i$11), null));
637 while (((t$0$PyObject = frame.getlocal(5)._ne(s$1)).__nonzero__() ? frame.getlocal(5)._in(frame.getlocal(1)) : t$0$PyObject).__nonzero__()) {
638 frame.setlocal(7, frame.getlocal(7)._add(frame.getlocal(5)));
639 frame.setlocal(3, frame.getlocal(3)._add(i$11));
640 frame.setlocal(5, frame.getlocal(0).__getslice__(frame.getlocal(3), frame.getlocal(3)._add(i$11), null));
642 if (frame.getglobal("os").__getattr__("environ").__getattr__("has_key").__call__(frame.getlocal(7)).__nonzero__()) {
643 frame.setlocal(4, frame.getlocal(4)._add(frame.getglobal("os").__getattr__("environ").__getitem__(frame.getlocal(7))));
645 if (frame.getlocal(5)._ne(s$1).__nonzero__()) {
646 frame.setlocal(4, frame.getlocal(4)._add(frame.getlocal(5)));
651 frame.setlocal(4, frame.getlocal(4)._add(frame.getlocal(5)));
653 frame.setlocal(3, frame.getlocal(3)._add(i$11));
655 return frame.getlocal(4);
658 private static PyObject main$27(PyFrame frame) {
659 frame.setglobal("__file__", s$51);
663 /* Common pathname manipulations, JDK version.
665 Instead of importing this module directly, import os and refer to this
669 frame.setlocal("java", org.python.core.imp.importOne("java", frame));
670 imp_accu = org.python.core.imp.importFrom("java.io", new String[] {"File"}, frame);
671 frame.setlocal("File", imp_accu[0]);
673 imp_accu = org.python.core.imp.importFrom("java.lang", new String[] {"System"}, frame);
674 frame.setlocal("System", imp_accu[0]);
676 frame.setlocal("os", org.python.core.imp.importOne("os", frame));
677 frame.setlocal("_tostr", new PyFunction(frame.f_globals, new PyObject[] {}, c$0__tostr));
678 frame.setlocal("dirname", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_dirname));
679 frame.setlocal("basename", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_basename));
680 frame.setlocal("split", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_split));
681 frame.setlocal("splitext", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_splitext));
682 frame.setlocal("splitdrive", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_splitdrive));
683 frame.setlocal("exists", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_exists));
684 frame.setlocal("isabs", new PyFunction(frame.f_globals, new PyObject[] {}, c$7_isabs));
685 frame.setlocal("isfile", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_isfile));
686 frame.setlocal("isdir", new PyFunction(frame.f_globals, new PyObject[] {}, c$9_isdir));
687 frame.setlocal("join", new PyFunction(frame.f_globals, new PyObject[] {}, c$10_join));
688 frame.setlocal("normcase", new PyFunction(frame.f_globals, new PyObject[] {}, c$11_normcase));
689 frame.setlocal("commonprefix", new PyFunction(frame.f_globals, new PyObject[] {}, c$12_commonprefix));
690 frame.setlocal("islink", new PyFunction(frame.f_globals, new PyObject[] {}, c$13_islink));
691 frame.setlocal("samefile", new PyFunction(frame.f_globals, new PyObject[] {}, c$14_samefile));
692 frame.setlocal("ismount", new PyFunction(frame.f_globals, new PyObject[] {}, c$15_ismount));
693 frame.setlocal("walk", new PyFunction(frame.f_globals, new PyObject[] {}, c$16_walk));
694 frame.setlocal("expanduser", new PyFunction(frame.f_globals, new PyObject[] {}, c$17_expanduser));
695 frame.setlocal("getuser", new PyFunction(frame.f_globals, new PyObject[] {}, c$18_getuser));
696 frame.setlocal("gethome", new PyFunction(frame.f_globals, new PyObject[] {}, c$19_gethome));
697 frame.setlocal("normpath", new PyFunction(frame.f_globals, new PyObject[] {}, c$20_normpath));
698 frame.setlocal("abspath", new PyFunction(frame.f_globals, new PyObject[] {}, c$21_abspath));
699 frame.setlocal("getsize", new PyFunction(frame.f_globals, new PyObject[] {}, c$22_getsize));
700 frame.setlocal("getmtime", new PyFunction(frame.f_globals, new PyObject[] {}, c$23_getmtime));
701 frame.setlocal("getatime", new PyFunction(frame.f_globals, new PyObject[] {}, c$24_getatime));
702 frame.setlocal("expandvars", new PyFunction(frame.f_globals, new PyObject[] {}, c$25_expandvars));
707 public static void moduleDictInit(PyObject dict) {
708 dict.__setitem__("__name__", new PyString("javapath"));
709 Py.runCode(new _PyInner().getMain(), dict, dict);
712 public static void main(String[] args) throws java.lang.Exception {
713 String[] newargs = new String[args.length+1];
714 newargs[0] = "javapath";
715 System.arraycopy(args, 0, newargs, 1, args.length);
716 Py.runMain(javapath._PyInner.class, newargs, javapath.jpy$packages, javapath.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});