summaryrefslogtreecommitdiffstats
path: root/pym/portage/locks.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-06-09 03:39:37 -0700
committerZac Medico <zmedico@gentoo.org>2011-06-09 03:39:37 -0700
commit65f3a4d8af054756b9b553c341118334b4526075 (patch)
tree00d130b87c175bd0146f73e11b104d00c98a2afa /pym/portage/locks.py
parentc249745ca37f996ef7de51d1be2997e6734d649b (diff)
downloadportage-65f3a4d8af054756b9b553c341118334b4526075.tar.gz
portage-65f3a4d8af054756b9b553c341118334b4526075.tar.bz2
portage-65f3a4d8af054756b9b553c341118334b4526075.zip
locks: use a private constant for fcntl.lockf
Diffstat (limited to 'pym/portage/locks.py')
-rw-r--r--pym/portage/locks.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/pym/portage/locks.py b/pym/portage/locks.py
index 1f8f58013..50a920061 100644
--- a/pym/portage/locks.py
+++ b/pym/portage/locks.py
@@ -25,6 +25,7 @@ if sys.hexversion >= 0x3000000:
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.
@@ -109,9 +110,9 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0,
# 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
@@ -135,7 +136,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0,
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))