Gentoo Archives: gentoo-commits

From: Brian Dolbec <brian.dolbec@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:pending commit in: catalyst/
Date: Tue, 02 Sep 2014 05:54:59
Message-Id: 1409637114.0fe0dba72ce7aaaad4efa32bf8aa65a655253e65.dol-sen@gentoo
1 commit: 0fe0dba72ce7aaaad4efa32bf8aa65a655253e65
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 22 08:34:41 2013 +0000
4 Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
5 CommitDate: Tue Sep 2 05:51:54 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=0fe0dba7
7
8 FIXME! Comment out a small code block causing TypeError.
9
10 This was also short circuiting another large code block. FIXME!!!! This
11 whole class seems overly complicated with TOO MANY nested try:excepts:
12
13 ---
14 catalyst/lock.py | 23 +++++++++++++++++------
15 1 file changed, 17 insertions(+), 6 deletions(-)
16
17 diff --git a/catalyst/lock.py b/catalyst/lock.py
18 index 78968cb..c90f5b8 100644
19 --- a/catalyst/lock.py
20 +++ b/catalyst/lock.py
21 @@ -27,11 +27,17 @@ class LockDir:
22 locking_method=fcntl.flock
23 lock_dirs_in_use=[]
24 die_on_failed_lock=True
25 +
26 def __del__(self):
27 + #print "Lock.__del__() 1"
28 self.clean_my_hardlocks()
29 + #print "Lock.__del__() 2"
30 self.delete_lock_from_path_list()
31 + #print "Lock.__del__() 3"
32 if self.islocked():
33 + #print "Lock.__del__() 4"
34 self.fcntl_unlock()
35 + #print "Lock.__del__() finnished"
36
37 def __init__(self,lockdir):
38 self.locked=False
39 @@ -179,7 +185,9 @@ class LockDir:
40 unlinkfile = 1
41 if not os.path.exists(self.lockfile):
42 print "lockfile does not exist '%s'" % self.lockfile
43 + #print "fcntl_unlock() , self.myfd:", self.myfd, type(self.myfd)
44 if (self.myfd != None):
45 + #print "fcntl_unlock() trying to close it "
46 try:
47 os.close(self.myfd)
48 self.myfd=None
49 @@ -193,11 +201,13 @@ class LockDir:
50 unlinkfile = 1
51 self.locking_method(self.myfd,fcntl.LOCK_UN)
52 except SystemExit, e:
53 - raise
54 + raise e
55 except Exception, e:
56 - os.close(self.myfd)
57 - self.myfd=None
58 - raise IOError, "Failed to unlock file '%s'\n" % self.lockfile
59 + #if self.myfd is not None:
60 + #print "fcntl_unlock() trying to close", self.myfd
61 + #os.close(self.myfd)
62 + #self.myfd=None
63 + #raise IOError, "Failed to unlock file '%s'\n%s" % (self.lockfile, str(e))
64 try:
65 # This sleep call was added to allow other processes that are
66 # waiting for a lock to be able to grab it before it is deleted.
67 @@ -224,7 +234,7 @@ class LockDir:
68 # if "DEBUG" in self.settings:
69 # print "Unlinked lockfile..."
70 except SystemExit, e:
71 - raise
72 + raise e
73 except Exception, e:
74 # We really don't care... Someone else has the lock.
75 # So it is their problem now.
76 @@ -236,7 +246,7 @@ class LockDir:
77 # open fd closed automatically on them.
78 #if type(lockfilename) == types.StringType:
79 # os.close(myfd)
80 -
81 + #print "fcntl_unlock() trying a last ditch close", self.myfd
82 if (self.myfd != None):
83 os.close(self.myfd)
84 self.myfd=None
85 @@ -421,6 +431,7 @@ class LockDir:
86 pass
87 return results
88
89 +
90 if __name__ == "__main__":
91
92 def lock_work():