Commits

Joseph Tate committed 088fe76

Support more recent versions of python-daemon

Comments (0)

Files changed (1)

daemon_parse/cli.py

 import daemon
-import daemon.pidlockfile
+try:
+    import daemon.pidlockfile
+    PIDLockFile = daemon.pidlockfile.PIDLockFile
+except ImportError:
+    import daemon.pidfile
+    PIDLockFile = daemon.pidfile.TimeoutPIDLockFile
+import daemon.pidfile
 import optparse
 import os
 import pwd, grp
     parser.values.gid = gid
 
 def createpidlockfile(option, opt, value, parser):
+    import epdb; epdb.st()
     if not value.startswith('/'):
         raise optparse.OptionValueError('pidfile must be a full path, not %s' % value)
     if not os.path.isdir(os.path.dirname(value)):
         raise optparse.OptionValueError('pidfile directory (%s) does not exist' % os.path.dirname(value))
     if os.path.exists(value):
         raise optparse.OptionValueError('pidfile exists: %s'% value)
-    parser.values.pidfile = daemon.pidlockfile.PIDLockFile(value)
+    parser.values.pidfile = PIDLockFile(value)
 
 allowed = ('chroot_directory', 'working_directory', 'umask', 'pidfile',
     'detach_process', 'uid', 'gid', 'prevent_core', 'files_preserve', 'stdin',