public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/
@ 2014-09-02  5:54 99% Brian Dolbec
  0 siblings, 0 replies; 1+ results
From: Brian Dolbec @ 2014-09-02  5:54 UTC (permalink / raw
  To: gentoo-commits

commit:     0fe0dba72ce7aaaad4efa32bf8aa65a655253e65
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 22 08:34:41 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep  2 05:51:54 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=0fe0dba7

FIXME! Comment out a small code block causing TypeError.

This was also short circuiting another large code block.  FIXME!!!! This
whole class seems overly complicated with TOO MANY nested try:excepts:

---
 catalyst/lock.py | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/catalyst/lock.py b/catalyst/lock.py
index 78968cb..c90f5b8 100644
--- a/catalyst/lock.py
+++ b/catalyst/lock.py
@@ -27,11 +27,17 @@ class LockDir:
 	locking_method=fcntl.flock
 	lock_dirs_in_use=[]
 	die_on_failed_lock=True
+
 	def __del__(self):
+		#print "Lock.__del__() 1"
 		self.clean_my_hardlocks()
+		#print "Lock.__del__() 2"
 		self.delete_lock_from_path_list()
+		#print "Lock.__del__() 3"
 		if self.islocked():
+			#print "Lock.__del__() 4"
 			self.fcntl_unlock()
+		#print "Lock.__del__() finnished"
 
 	def __init__(self,lockdir):
 		self.locked=False
@@ -179,7 +185,9 @@ class LockDir:
 		unlinkfile = 1
 		if not os.path.exists(self.lockfile):
 			print "lockfile does not exist '%s'" % self.lockfile
+			#print "fcntl_unlock() , self.myfd:", self.myfd, type(self.myfd)
 			if (self.myfd != None):
+				#print "fcntl_unlock() trying to close it "
 				try:
 					os.close(self.myfd)
 					self.myfd=None
@@ -193,11 +201,13 @@ class LockDir:
 					unlinkfile = 1
 					self.locking_method(self.myfd,fcntl.LOCK_UN)
 			except SystemExit, e:
-				raise
+				raise e
 			except Exception, e:
-				os.close(self.myfd)
-				self.myfd=None
-				raise IOError, "Failed to unlock file '%s'\n" % self.lockfile
+				#if self.myfd is not None:
+					#print "fcntl_unlock() trying to close", self.myfd
+					#os.close(self.myfd)
+					#self.myfd=None
+				#raise IOError, "Failed to unlock file '%s'\n%s" % (self.lockfile, str(e))
 				try:
 					# This sleep call was added to allow other processes that are
 					# waiting for a lock to be able to grab it before it is deleted.
@@ -224,7 +234,7 @@ class LockDir:
 #						if "DEBUG" in self.settings:
 #							print "Unlinked lockfile..."
 				except SystemExit, e:
-					raise
+					raise e
 				except Exception, e:
 					# We really don't care... Someone else has the lock.
 					# So it is their problem now.
@@ -236,7 +246,7 @@ class LockDir:
 					# open fd closed automatically on them.
 					#if type(lockfilename) == types.StringType:
 					#        os.close(myfd)
-
+		#print "fcntl_unlock() trying a last ditch close", self.myfd
 		if (self.myfd != None):
 			os.close(self.myfd)
 			self.myfd=None
@@ -421,6 +431,7 @@ class LockDir:
 						pass
 		return results
 
+
 if __name__ == "__main__":
 
 	def lock_work():


^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2014-09-02  5:54 99% [gentoo-commits] proj/catalyst:pending commit in: catalyst/ Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox