Issue1664366

classification
Title: Patch for [1648449] os.path.normcase broken in Windows
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, fwierzbicki, hsk0
Priority: normal Keywords: patch

Created on 2007-02-20.14:26:01 by hsk0, last changed 2007-07-21.13:46:36 by fwierzbicki.

Messages
msg2646 (view) Author: howard kapustein (hsk0) Date: 2007-02-20.14:26:01
javaos unconditionally imports javapath as os.path
This breaks several things as javaos doesn't properly implement several os.path functions, relies on the underlying live system at the moment instead of purely definitional expectations, and fundamentally provides a different model of os.path than CPython does (always loads javapath=os.path, instead of conditionally making os.path=ntpath, posixpath, macpath, etc).

You can see the full details in my comments to the bug
http://sourceforge.net/tracker/index.php?func=detail&aid=1648449&group_id=12867&atid=112867

This patch also fixes
[1661700] os.path.abspath raises IOException if drive not accessible

See my comments on that bug as well for why
http://sourceforge.net/tracker/index.php?func=detail&aid=1661700&group_id=12867&atid=112867

This likely fixes other problems as well.

javaos.py is from Jython 2.2b1
javaoshk.py has my modifications
Here's the diff
--------------------
[~] diff -u javaos.py javaoshk.py
--- javaos.py   2007-02-20 09:06:22.000000000 -0500
+++ javaoshk.py 2007-02-20 09:08:35.000000000 -0500
@@ -28,9 +28,29 @@

 import java
 from java.io import File
-import javapath as path
 from UserDict import UserDict

+# Load the right flavor of os.path
+_osname = None
+_jythonospath = java.lang.System.getProperty('jython.os.path')
+if _jythonospath:
+    _jythonospath =  _jythonospath.lower()
+    if _jythonospath in ['java', 'dos', 'mac', 'nt', 'posix']:
+        _osname = _jythonospath
+if _osname == None:
+    _osname = java.lang.System.getProperty('os.name').lower()
+if _osname == 'nt' or  _osname.startswith('windows'):
+    import ntpath as path
+elif _osname.startswith('mac') and not _osname.endswith('x'):
+    import macpath as path
+elif _osname == 'dos':
+    import dospath as path
+elif (_osname == 'posix') or ((File.pathSeparator == ':') and ('vms' not
+in _osname) and (not _osname.startswith('mac') or _osname.endswith('x'))):
+    import posixpath as path
+else:
+    import javapath as path
+
 class stat_result:
   import stat as _stat
msg2647 (view) Author: Charlie Groves (cgroves) Date: 2007-05-14.06:06:26
Unfortunately the platform specific path modules expect os.stat to work properly, which isn't the case due to Java limitations.  Until that's addressed we can't just use them as javapath has Java specific workarounds that don't use stat.
msg2648 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2007-07-21.13:46:36
oops -- I didn't notice this was closed.
History
Date User Action Args
2007-02-20 14:26:01hsk0create