/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/lock.py

  • Committer: Andrew Bennetts
  • Date: 2008-02-18 08:30:38 UTC
  • mto: This revision was merged to the branch mainline in revision 3756.
  • Revision ID: andrew.bennetts@canonical.com-20080218083038-tts55zsx5xrz3l2e
Lots of assorted hackery to reduce the number of imports for common operations.  Improves 'rocks', 'st' and 'help' times by ~50ms on my laptop.

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
    have_fcntl = True
89
89
except ImportError:
90
90
    have_fcntl = False
91
 
try:
92
 
    import win32con, win32file, pywintypes, winerror, msvcrt
93
 
    have_pywin32 = True
94
 
except ImportError:
95
 
    have_pywin32 = False
96
 
try:
97
 
    import ctypes, msvcrt
98
 
    have_ctypes = True
99
 
except ImportError:
100
 
    have_ctypes = False
 
91
 
 
92
have_pywin32 = False
 
93
if sys.platform == 'win32':
 
94
    try:
 
95
        import win32con, win32file, pywintypes, winerror, msvcrt
 
96
        have_pywin32 = True
 
97
    except ImportError:
 
98
        pass
101
99
 
102
100
 
103
101
_lock_classes = []
328
326
    _lock_classes.append(('pywin32', _w32c_WriteLock, _w32c_ReadLock))
329
327
 
330
328
 
331
 
if have_ctypes and sys.platform == 'win32':
 
329
have_ctypes_win32 = False
 
330
if sys.platform == 'win32':
 
331
    try:
 
332
        import ctypes, msvcrt
 
333
        have_ctypes_win32 = True
 
334
    except ImportError:
 
335
        pass
 
336
 
 
337
if have_ctypes_win32:
332
338
    # These constants were copied from the win32con.py module.
333
339
    LOCKFILE_FAIL_IMMEDIATELY = 1
334
340
    LOCKFILE_EXCLUSIVE_LOCK = 2