]> git.michaelhowe.org Git - packages/b/bup.git/commitdiff
cmd-index.py: Retry os.open without O_LARGEFILE if not supported.
authorLukasz Kosewski <lkosewsk@gmail.com>
Sun, 10 Jan 2010 08:57:42 +0000 (03:57 -0500)
committerLukasz Kosewski <lkosewsk@gmail.com>
Sun, 10 Jan 2010 08:57:42 +0000 (03:57 -0500)
Python under Cygwin doesn't have os.O_LARGEFILE, so if we receive an
'AttributeError' exception trying to open something, just remove
O_LARGEFILE and try again.

cmd-index.py

index ef596b7d7909b6b43dc9d4f56a6ff2c9809cec82..e3d1b7be244f64a28437b71ded1cd5e5a93a0ab1 100755 (executable)
@@ -6,7 +6,10 @@ from helpers import *
 class OsFile:
     def __init__(self, path):
         self.fd = None
-        self.fd = os.open(path, os.O_RDONLY|os.O_LARGEFILE|os.O_NOFOLLOW)
+        try:
+            self.fd = os.open(path, os.O_RDONLY|os.O_LARGEFILE|os.O_NOFOLLOW)
+        except AttributeError:
+            self.fd = os.open(path, os.O_RDONLY|os.O_NOFOLLOW)
         #self.st = os.fstat(self.fd)
         
     def __del__(self):