Only import lockfile.pidlockfile when needed
authorGuido Günther <agx@sigxcpu.org>
Mon, 25 Jan 2016 07:01:32 +0000 (08:01 +0100)
committerGuido Günther <agx@sigxcpu.org>
Tue, 26 Jan 2016 17:25:13 +0000 (18:25 +0100)
Debian Jessie python-lockfile 0.8 lacks it and a pidlockfile is not
always needed.

calypso.py

index c3c199998006cb19bb1a59c1b610cfbd59787a76..7d8c31b31bac50bdd08e634eb61de3613970a557 100755 (executable)
@@ -38,7 +38,6 @@ arguments.
 
 import daemon
 import lockfile
-from lockfile import pidlockfile
 import logging
 import optparse
 import os
@@ -149,6 +148,7 @@ if not options.daemon:
 context = daemon.DaemonContext()
 context.umask = 0o002
 if options.pidfile:
+    from lockfile import pidlockfile
     # Generate a pidfile where requested
     context.pidfile = pidlockfile.PIDLockFile(options.pidfile)
 with context: