Rev 2367: Handle ERROR_DIRECTORY for python 2.5 in http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/win32_notdir

John Arbash Meinel john at arbash-meinel.com
Tue Mar 20 19:19:42 GMT 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/win32_notdir

------------------------------------------------------------
revno: 2367
revision-id: john at arbash-meinel.com-20070320191916-0qxauqd00dehfrxl
parent: john at arbash-meinel.com-20070319232736-qsk1w9068h5sm1as
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: win32_notdir
timestamp: Tue 2007-03-20 14:19:16 -0500
message:
  Handle ERROR_DIRECTORY for python 2.5
modified:
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
-------------- next part --------------
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-03-19 23:24:56 +0000
+++ b/bzrlib/workingtree_4.py	2007-03-20 19:19:16 +0000
@@ -2069,12 +2069,17 @@
                 try:
                     current_dir_info = dir_iterator.next()
                 except OSError, e:
-                    if (e.errno in (errno.ENOENT, errno.ENOTDIR)
-                        or (sys.platform == 'win32'
-                            and e.errno in (ERROR_DIRECTORY,))):
-                        # there may be directories in the inventory even though
-                        # this path is not a file on disk: so mark it as end of
-                        # iterator
+                    # on win32, python2.4 has e.errno == ERROR_DIRECTORY, but
+                    # python 2.5 has e.errno == EINVAL,
+                    #            and e.winerror == ERROR_DIRECTORY
+                    e_winerror = getattr(e, 'winerror', None)
+                    # there may be directories in the inventory even though
+                    # this path is not a file on disk: so mark it as end of
+                    # iterator
+                    if e.errno in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL):
+                        current_dir_info = None
+                    elif (sys.platform == 'win32'
+                          and ERROR_DIRECTORY in (e.errno, e_winerror)):
                         current_dir_info = None
                     else:
                         raise



More information about the bazaar-commits mailing list