~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lock.py

  • Committer: Marius Kruger
  • Date: 2008-10-03 21:31:00 UTC
  • mfrom: (3763 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3809.
  • Revision ID: amanic@gmail.com-20081003213100-q4rv2l9pn8qto9o0
merge with bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
        return self.lock_url == other.lock_url and self.details == other.details
81
81
 
82
82
 
 
83
try:
 
84
    import fcntl
 
85
    have_fcntl = True
 
86
except ImportError:
 
87
    have_fcntl = False
 
88
 
 
89
have_pywin32 = False
 
90
have_ctypes_win32 = False
 
91
if sys.platform == 'win32':
 
92
    import msvcrt
 
93
    try:
 
94
        import win32con, win32file, pywintypes, winerror
 
95
        have_pywin32 = True
 
96
    except ImportError:
 
97
        pass
 
98
 
 
99
    try:
 
100
        import ctypes
 
101
        have_ctypes_win32 = True
 
102
    except ImportError:
 
103
        pass
 
104
 
 
105
 
83
106
class _OSLock(object):
84
107
 
85
108
    def __init__(self):
119
142
        raise NotImplementedError()
120
143
 
121
144
 
122
 
try:
123
 
    import fcntl
124
 
    have_fcntl = True
125
 
except ImportError:
126
 
    have_fcntl = False
127
 
try:
128
 
    import win32con, win32file, pywintypes, winerror, msvcrt
129
 
    have_pywin32 = True
130
 
except ImportError:
131
 
    have_pywin32 = False
132
 
try:
133
 
    import ctypes, msvcrt
134
 
    have_ctypes = True
135
 
except ImportError:
136
 
    have_ctypes = False
137
 
 
138
 
 
139
145
_lock_classes = []
140
146
 
141
147
 
368
374
    _lock_classes.append(('pywin32', _w32c_WriteLock, _w32c_ReadLock))
369
375
 
370
376
 
371
 
if have_ctypes and sys.platform == 'win32':
 
377
if have_ctypes_win32:
372
378
    # These constants were copied from the win32con.py module.
373
379
    LOCKFILE_FAIL_IMMEDIATELY = 1
374
380
    LOCKFILE_EXCLUSIVE_LOCK = 2