Mercurial > public > mercurial-scm > hg-stable
diff mercurial/windows.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 | fa901423ac23 |
children | 4429751f5da7 |
line wrap: on
line diff
--- a/mercurial/windows.py Thu May 14 14:12:32 2009 -0700 +++ b/mercurial/windows.py Wed May 13 21:36:16 2009 +0200 @@ -8,9 +8,17 @@ from i18n import _ import osutil, error import errno, msvcrt, os, re, sys + nulldev = 'NUL:' +umask = 002 -umask = 002 +# wrap osutil.posixfile to provide friendlier exceptions +def posixfile(name, mode='r', buffering=-1): + try: + return osutil.posixfile(name, mode, buffering) + except WindowsError, err: + raise WinIOError(err) +posixfile.__doc__ = osutil.posixfile.__doc__ class winstdout: '''stdout on windows misbehaves if sent through a pipe''' @@ -270,20 +278,5 @@ try: # override functions with win32 versions if possible from win32 import * - if not _is_win_9x(): - posixfile = posixfile_nt - try: - # fast, buffered POSIX-like file support - from osutil import posixfile as _posixfile - def posixfile(name, mode='r', buffering=-1): - # wrap osutil.posixfile to provide friendlier exceptions - try: - return _posixfile(name, mode, buffering) - except WindowsError, err: - raise WinIOError(err) - posixfile.__doc__ = _posixfile.__doc__ - except ImportError: - # slow, unbuffered POSIX-like file support - posixfile = posixfile_nt except ImportError: - posixfile = file + pass