basestring = str
HARDLINK_FD = -2
+_default_lock_fn = fcntl.lockf
# Used by emerge in order to disable the "waiting for lock" message
# so that it doesn't interfere with the status display.
# try for a non-blocking lock, if it's held, throw a message
# we're waiting on lockfile and use a blocking attempt.
- locking_method = fcntl.lockf
+ locking_method = _default_lock_fn
try:
- fcntl.lockf(myfd,fcntl.LOCK_EX|fcntl.LOCK_NB)
+ locking_method(myfd, fcntl.LOCK_EX|fcntl.LOCK_NB)
except IOError as e:
if "errno" not in dir(e):
raise
out.ebegin(waiting_msg)
# try for the exclusive lock now.
try:
- fcntl.lockf(myfd, fcntl.LOCK_EX)
+ locking_method(myfd, fcntl.LOCK_EX)
except EnvironmentError as e:
if out is not None:
out.eend(1, str(e))