|
|
@ -1217,6 +1217,8 @@ if sys.platform == 'win32':
|
|
|
|
raise OSError('Unlocking file failed: %r' % ctypes.FormatError())
|
|
|
|
raise OSError('Unlocking file failed: %r' % ctypes.FormatError())
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
|
|
|
|
# Some platforms, such as Jython, is missing fcntl
|
|
|
|
|
|
|
|
try:
|
|
|
|
import fcntl
|
|
|
|
import fcntl
|
|
|
|
|
|
|
|
|
|
|
|
def _lock_file(f, exclusive):
|
|
|
|
def _lock_file(f, exclusive):
|
|
|
@ -1224,6 +1226,14 @@ else:
|
|
|
|
|
|
|
|
|
|
|
|
def _unlock_file(f):
|
|
|
|
def _unlock_file(f):
|
|
|
|
fcntl.flock(f, fcntl.LOCK_UN)
|
|
|
|
fcntl.flock(f, fcntl.LOCK_UN)
|
|
|
|
|
|
|
|
except ImportError:
|
|
|
|
|
|
|
|
UNSUPPORTED_MSG = 'file locking is not supported on this platform'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _lock_file(f, exclusive):
|
|
|
|
|
|
|
|
raise IOError(UNSUPPORTED_MSG)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _unlock_file(f):
|
|
|
|
|
|
|
|
raise IOError(UNSUPPORTED_MSG)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class locked_file(object):
|
|
|
|
class locked_file(object):
|
|
|
|