View | Details | Raw Unified | Return to bug 149944
Collapse All | Expand All

(-)b/py-daemon/Makefile (-1 / +1 lines)
Lines 16-22 Link Here
16
COMMENT= Well-behaved daemon framework for Python
16
COMMENT= Well-behaved daemon framework for Python
17
17
18
BUILD_DEPENDS=\
18
BUILD_DEPENDS=\
19
	${PYTHON_PKGNAMEPREFIX}lockfile>0:${PORTSDIR}/devel/py-lockfile
19
	${PYTHON_PKGNAMEPREFIX}lockfile>=0.9:${PORTSDIR}/devel/py-lockfile
20
20
21
RUN_DEPENDS:=	${BUILD_DEPENDS}
21
RUN_DEPENDS:=	${BUILD_DEPENDS}
22
22
(-)b/py-daemon/files/patch-daemon-pidlockfile.py (+72 lines)
Added Link Here
1
--- daemon/pidlockfile.py.orig	2010-08-24 16:57:37.753374406 +0000
2
+++ daemon/pidlockfile.py	2010-08-24 16:58:57.825989360 +0000
3
@@ -22,6 +22,7 @@
4
     NotLocked, NotMyLock,
5
     )
6
 
7
+from lockfile.pidlockfile import PIDLockFile
8
 
9
 class PIDFileError(Exception):
10
     """ Abstract base class for errors specific to PID files. """
11
@@ -30,61 +31,6 @@
12
     """ Raised when parsing contents of PID file fails. """
13
 
14
 
15
-class PIDLockFile(LinkFileLock, object):
16
-    """ Lockfile implemented as a Unix PID file.
17
-
18
-        The PID file is named by the attribute `path`. When locked,
19
-        the file will be created with a single line of text,
20
-        containing the process ID (PID) of the process that acquired
21
-        the lock.
22
-
23
-        The lock is acquired and maintained as per `LinkFileLock`.
24
-
25
-        """
26
-
27
-    def read_pid(self):
28
-        """ Get the PID from the lock file.
29
-            """
30
-        result = read_pid_from_pidfile(self.path)
31
-        return result
32
-
33
-    def acquire(self, *args, **kwargs):
34
-        """ Acquire the lock.
35
-
36
-            Locks the PID file then creates the PID file for this
37
-            lock. The `timeout` parameter is used as for the
38
-            `LinkFileLock` class.
39
-
40
-            """
41
-        super(PIDLockFile, self).acquire(*args, **kwargs)
42
-        try:
43
-            write_pid_to_pidfile(self.path)
44
-        except OSError, exc:
45
-            error = LockFailed("%(exc)s" % vars())
46
-            raise error
47
-
48
-    def release(self):
49
-        """ Release the lock.
50
-
51
-            Removes the PID file then releases the lock, or raises an
52
-            error if the current process does not hold the lock.
53
-
54
-            """
55
-        if self.i_am_locking():
56
-            remove_existing_pidfile(self.path)
57
-        super(PIDLockFile, self).release()
58
-
59
-    def break_lock(self):
60
-        """ Break an existing lock.
61
-
62
-            If the lock is held, breaks the lock and removes the PID
63
-            file.
64
-
65
-            """
66
-        super(PIDLockFile, self).break_lock()
67
-        remove_existing_pidfile(self.path)
68
-
69
-
70
 class TimeoutPIDLockFile(PIDLockFile):
71
     """ Lockfile with default timeout, implemented as a Unix PID file.
72

Return to bug 149944