[Jython-checkins] jython: Issue 1837 fix. Replace use of os.path.samefile with path test in gderived.py,
frank.wierzbicki
jython-checkins at python.org
Thu Mar 29 18:04:41 CEST 2012
http://hg.python.org/jython/rev/76b77b00a4fe
changeset: 6496:76b77b00a4fe
user: ja...py at farowl.co.uk
date: Sat Feb 11 23:32:57 2012 +0000
summary:
Issue 1837 fix. Replace use of os.path.samefile with path test in gderived.py, so it works on Windows
files:
src/templates/gderived.py | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/templates/gderived.py b/src/templates/gderived.py
--- a/src/templates/gderived.py
+++ b/src/templates/gderived.py
@@ -23,6 +23,15 @@
modif_re = re.compile(r"(?:\((\w+)\))?(\w+)")
+# os.path.samefile unavailable on Windows before Python v3.2
+if hasattr(os.path,"samefile"):
+ # Good: available on this platform
+ os_path_samefile = os.path.samefile
+else:
+ def os_path_samefile(a,b):
+ 'Files are considered the same if their absolute paths are equal'
+ return os.path.abspath(a)==os.path.abspath(b)
+
class Gen:
priority_order = ['require','define','base_class',
@@ -212,7 +221,7 @@
org.python.core
"""
parent = os.path.dirname(fn)
- if os.path.samefile(parent, core_dir):
+ if os_path_samefile(parent, core_dir):
return result
print 'Fixing header for: %s' % fn
@@ -220,7 +229,7 @@
while True:
parent, tail = os.path.split(parent)
dirs.insert(0, tail)
- if os.path.samefile(parent, org_python_dir) or not tail:
+ if os_path_samefile(parent, org_python_dir) or not tail:
break
result = result.splitlines()
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list