/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/Lib/fileutil.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/Lib/fileutil.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 373 by bh, Fri Sep 20 17:27:36 2002 UTC revision 374 by jan, Mon Jan 27 14:20:02 2003 UTC
# Line 14  __version__ = "$Revision$" Line 14  __version__ = "$Revision$"
14  import os.path  import os.path
15  from string import split, join  from string import split, join
16    
17    from Thuban import _
18    
19  def relative_filename_common(dir, absname, sep):  def relative_filename_common(dir, absname, sep):
20      """Return a filename relative to dir for the absolute file name absname.      """Return a filename relative to dir for the absolute file name absname.
# Line 80  def relative_filename_posix(dir, absname Line 81  def relative_filename_posix(dir, absname
81          return absname          return absname
82    
83      if not posixpath.isabs(dir):      if not posixpath.isabs(dir):
84          raise TypeError("first argument must be an absolute filename")          raise TypeError(_("first argument must be an absolute filename"))
85    
86      dir = posixpath.normpath(dir)      dir = posixpath.normpath(dir)
87      absname = posixpath.normpath(absname)      absname = posixpath.normpath(absname)
# Line 131  def relative_filename_nt(dir, absname): Line 132  def relative_filename_nt(dir, absname):
132      #print dir_drive, dir_rest      #print dir_drive, dir_rest
133      #print absname_drive, absname_rest      #print absname_drive, absname_rest
134      if not dir_drive or not absname_drive:      if not dir_drive or not absname_drive:
135          raise TypeError("Both parameters must have a drive letter")          raise TypeError(_("Both parameters must have a drive letter"))
136    
137      if not ntpath.isabs(dir_rest):      if not ntpath.isabs(dir_rest):
138          raise TypeError("first argument must be an absolute filename")          raise TypeError(_("first argument must be an absolute filename"))
139    
140      # handle some special cases      # handle some special cases
141      if not ntpath.isabs(absname_rest):      if not ntpath.isabs(absname_rest):
# Line 156  if os.name == "posix": Line 157  if os.name == "posix":
157  elif os.name == "nt":  elif os.name == "nt":
158      relative_filename = relative_filename_nt      relative_filename = relative_filename_nt
159  else:  else:
160      raise RuntimeError("No implementation of relative_filename"      raise RuntimeError(_("No implementation of relative_filename"
161                         " available for platform" + os.name)                         " available for platform") + os.name)
162    
163  __test__ = {"relative_filename_posix": relative_filename_posix,  __test__ = {"relative_filename_posix": relative_filename_posix,
164              "relative_filename_nt": relative_filename_nt}              "relative_filename_nt": relative_filename_nt}

Legend:
Removed from v.373  
changed lines
  Added in v.374

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26