comparison mercurial/pure/osutil.py @ 8421:b6d0fa8c7685

posixfile: remove posixfile_nt and fix import bug in windows.py The posixfile_nt class has been superseded by posixfile in osutils.c, which works on Windows NT and above. All other systems get the regular python file class which is assigned to posixfile in posix.py (for POSIX) and in the pure python version of osutils.py (for Win 9x or Windows NT in pure mode).
author Sune Foldager <cryo@cyanite.org>
date Wed, 13 May 2009 21:36:16 +0200
parents 823f25b25dea
children 3b76321aa0de
comparison
equal deleted inserted replaced
8420:f53bc3e37655 8421:b6d0fa8c7685
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2, incorporated herein by reference. 6 # GNU General Public License version 2, incorporated herein by reference.
7 7
8 import os 8 import os
9 import stat as _stat 9 import stat as _stat
10
11 posixfile = file
10 12
11 def _mode_to_kind(mode): 13 def _mode_to_kind(mode):
12 if _stat.S_ISREG(mode): return _stat.S_IFREG 14 if _stat.S_ISREG(mode): return _stat.S_IFREG
13 if _stat.S_ISDIR(mode): return _stat.S_IFDIR 15 if _stat.S_ISDIR(mode): return _stat.S_IFDIR
14 if _stat.S_ISLNK(mode): return _stat.S_IFLNK 16 if _stat.S_ISLNK(mode): return _stat.S_IFLNK
45 if stat: 47 if stat:
46 result.append((fn, _mode_to_kind(st.st_mode), st)) 48 result.append((fn, _mode_to_kind(st.st_mode), st))
47 else: 49 else:
48 result.append((fn, _mode_to_kind(st.st_mode))) 50 result.append((fn, _mode_to_kind(st.st_mode)))
49 return result 51 return result
52