summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/EbuildBuildDir.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/pym/_emerge/EbuildBuildDir.py b/pym/_emerge/EbuildBuildDir.py
index 921cf807f..de3f56dfb 100644
--- a/pym/_emerge/EbuildBuildDir.py
+++ b/pym/_emerge/EbuildBuildDir.py
@@ -74,21 +74,17 @@ class EbuildBuildDir(SlotObject):
self._lock_obj = None
self.locked = False
self.settings.pop('PORTAGE_BUILDIR_LOCKED', None)
-
- catdir = self._catdir
- catdir_lock = None
+ catdir_lock = AsynchronousLock(path=self._catdir, scheduler=self.scheduler)
+ catdir_lock.start()
+ catdir_lock.wait()
try:
- catdir_lock = portage.locks.lockdir(catdir)
+ os.rmdir(self._catdir)
+ except OSError as e:
+ if e.errno not in (errno.ENOENT,
+ errno.ENOTEMPTY, errno.EEXIST):
+ raise
finally:
- if catdir_lock:
- try:
- os.rmdir(catdir)
- except OSError as e:
- if e.errno not in (errno.ENOENT,
- errno.ENOTEMPTY, errno.EEXIST):
- raise
- del e
- portage.locks.unlockdir(catdir_lock)
+ catdir_lock.unlock()
class AlreadyLocked(portage.exception.PortageException):
pass