Marcus R. Brown avatar Marcus R. Brown committed bdedd8a

Finish removing dependencies on the python module and jnr-posix.

Comments (0)

Files changed (7)

src/org/python/core/Py.java

 import java.util.List;
 import org.python.core.adapter.ClassicPyObjectAdapter;
 import org.python.core.adapter.ExtensiblePyObjectAdapter;
-import org.python.modules.posix.PosixModule;
+// MRB TODO: Remove posix module.
+//import org.python.modules.posix.PosixModule;
 import org.python.util.Generic;
 
 public final class Py {
 
     public static PyException OSError(Constant errno) {
         int value = errno.value();
-        PyObject args = new PyTuple(Py.newInteger(value), PosixModule.strerror(value));
+        // MRB TODO: Remove posix module.
+        PyObject args = new PyTuple(Py.newInteger(value), new PyString("<TODO>")/*PosixModule.strerror(value)*/);
         return new PyException(Py.OSError, args);
     }
 
         int value = errno.value();
         // Pass to strerror because constantine currently lacks Errno descriptions on
         // Windows, and strerror falls back to Linux's
-        PyObject args = new PyTuple(Py.newInteger(value), PosixModule.strerror(value),
+        // MRB TODO: Remove posix module.
+        PyObject args = new PyTuple(Py.newInteger(value), new PyString("<TODO")/*PosixModule.strerror(value)*/,
                                     Py.newString(filename));
         return new PyException(Py.OSError, args);
     }
 
     public static PyException IOError(Constant errno) {
         int value = errno.value();
-        PyObject args = new PyTuple(Py.newInteger(value), PosixModule.strerror(value));
+        // MRB TODO: Remove posix module.
+        PyObject args = new PyTuple(Py.newInteger(value), new PyString("<TODO>")/*PosixModule.strerror(value)*/);
         return new PyException(Py.IOError, args);
     }
 
     public static PyException IOError(Constant errno, String filename) {
         int value = errno.value();
-        PyObject args = new PyTuple(Py.newInteger(value), PosixModule.strerror(value),
+        // MRB TODO: Remove posix module.
+        PyObject args = new PyTuple(Py.newInteger(value), new PyString("<TODO>")/*PosixModule.strerror(value)*/,
                                     Py.newString(filename));
         return new PyException(Py.IOError, args);
     }

src/org/python/core/PySystemState.java

 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
-import org.jruby.ext.posix.util.Platform;
+// MRB TODO: Remove posix module.
+//import org.jruby.ext.posix.util.Platform;
 import org.python.Version;
 import org.python.core.adapter.ClassicPyObjectAdapter;
 import org.python.core.adapter.ExtensiblePyObjectAdapter;
         File file = new File(path);
         // Python considers r'\Jython25' and '/Jython25' abspaths on Windows, unlike
         // java.io.File
-        if (!file.isAbsolute() && (!Platform.IS_WINDOWS
+        // MRB TODO: Remove posix module.
+        if (!file.isAbsolute() && (true/*!Platform.IS_WINDOWS*/
                                    || !(path.startsWith("\\") || path.startsWith("/")))) {
             if (sys == null) {
                 sys = Py.getSystemState();
                     if (jarIndex > 0) {
                         jarIndex += 4;
                         int start = VFSZIP_PREFIX.length();
-                        if (Platform.IS_WINDOWS) {
+                        // MRB TODO: Remove posix module.
+                        if (false/*Platform.IS_WINDOWS*/) {
                             // vfszip:/C:/some/path/jython.jar/org/python/core/PySystemState.class
                             start++;
                         }

src/org/python/core/io/FileIO.java

 import java.nio.channels.FileChannel;
 
 import com.kenai.constantine.platform.Errno;
-import org.jruby.ext.posix.util.Platform;
+// MRB TODO: Remove posix module.
+//import org.jruby.ext.posix.util.Platform;
 import org.python.core.Py;
 import org.python.core.util.RelativeFile;
-import org.python.modules.posix.PosixModule;
+// MRB TODO: Remove posix module.
+//import org.python.modules.posix.PosixModule;
 
 /**
  * Raw I/O implementation for OS files.
                 // ERROR_INVALID_HANDLE on ttys. Identifying those by the IOException
                 // message is tedious as their messages are localized, so we suppress them
                 // all =[
+                // MRB TODO: Remove posix module.
+                /*
                 if (Platform.IS_WINDOWS ||
                     ((Platform.IS_SOLARIS || Platform.IS_LINUX)
                      && Errno.EINVAL.description().equals(ioe.getMessage()))) {
                     return;
                 }
+                */
                 throw Py.IOError(ioe);
             }
         }
         if (file == null || fileOutputStream == null) {
             return false;
         }
+        // MRB TODO: Remove posix module.
+        return false;
+        /*
         try {
             return PosixModule.getPOSIX().isatty(file != null
                                                  ? file.getFD() : fileOutputStream.getFD());
         } catch (IOException e) {
             return false;
         }
+        */
     }
 
     @Override

src/org/python/core/io/StreamIO.java

 import java.nio.channels.WritableByteChannel;
 
 import org.python.core.Py;
-import org.python.modules.posix.PosixModule;
+// MRB TODO: Remove posix module.
+//import org.python.modules.posix.PosixModule;
 
 /**
  * Raw I/O implementation for simple streams.
             return false;
         }
 
-        return PosixModule.getPOSIX().isatty(fd);
+        // MRB TODO: Remove posix module.
+        return false;//PosixModule.getPOSIX().isatty(fd);
     }
 
     @Override

src/org/python/core/util/PlatformUtil.java

 /* Copyright (c) 2009 Jython project */
 package org.python.core.util;
 
-import org.jruby.ext.posix.util.Platform;
+// MRB TODO: Remove posix module.
+//import org.jruby.ext.posix.util.Platform;
 
 /**
  * Methods for testing the platform/operating system that we are on.
         // Currently we just check to see if we are on windows or macs, which are commonly
         // (though not always!) case insensitive.  There are certainly cases where this is
         // not sufficient, like the case of mounted filesystems.
-        return Platform.IS_MAC || Platform.IS_WINDOWS;
+        // MRB TODO: Remove posix module.
+        return false;//Platform.IS_MAC || Platform.IS_WINDOWS;
     }
 }

src/org/python/modules/errno.java

 import com.kenai.constantine.Constant;
 import com.kenai.constantine.ConstantSet;
 import com.kenai.constantine.platform.Errno;
-import org.jruby.ext.posix.util.Platform;
+// MRB TODO: Remove posix module.
+//import org.jruby.ext.posix.util.Platform;
 import org.python.core.ClassDictInit;
 import org.python.core.Py;
 import org.python.core.PyDictionary;
     public static final PyObject errorcode = new PyDictionary();
 
     public static void classDictInit(PyObject dict) {
-        if (Platform.IS_WINDOWS) {
+        // MRB TODO: Remove posix module.
+        if (false/*Platform.IS_WINDOWS*/) {
             initWindows(dict);
         } else {
             initPosix(dict);

src/org/python/util/jython.java

 import org.python.core.imp;
 import org.python.core.util.RelativeFile;
 import org.python.modules._systemrestart;
-import org.python.modules.posix.PosixModule;
+// MRB TODO: Remove posix module.
+//import org.python.modules.posix.PosixModule;
 import org.python.modules.thread.thread;
 
 public class jython {
                        throw Py.IOError(e);
                    }
                    try {
-                       if (PosixModule.getPOSIX().isatty(file.getFD())) {
+                       // MRB TODO: Remove posix module.
+                       if (false/*PosixModule.getPOSIX().isatty(file.getFD())*/) {
                            opts.interactive = true;
                            interp.interact(null, new PyFile(file));
                            return;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.