Use try_imports rather for conditional imports.

We're starting to use this elsewhere in OpenStack... avoids having to
do pyflakes workaround tricks.

Change-Id: Ic767677e87f30794d49baf100e3ded7555272df6
Reviewed-on: https://review.openstack.org/16851
Reviewed-by: James E. Blair <corvus@inaugust.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: Monty Taylor <mordred@inaugust.com>
Tested-by: Jenkins
diff --git a/tools/pip-requires b/tools/pip-requires
index 703734f..e681a0c 100644
--- a/tools/pip-requires
+++ b/tools/pip-requires
@@ -6,3 +6,4 @@
 GitPython>=0.3.2.RC1
 lockfile
 python-daemon
+extras
diff --git a/zuul/cmd/server.py b/zuul/cmd/server.py
index 4f77610..b4f2cec 100755
--- a/zuul/cmd/server.py
+++ b/zuul/cmd/server.py
@@ -15,14 +15,11 @@
 import argparse
 import ConfigParser
 import daemon
+import extras
 
-try:
-    import daemon.pidlockfile as pid_file_module
-    pid_file_module  # workaround for pyflakes issue #13
-except:
-    # as of python-daemon 1.6 it doesn't bundle pidlockfile anymore
-    # instead it depends on lockfile-0.9.1 which uses pidfile.
-    import daemon.pidfile as pid_file_module
+# as of python-daemon 1.6 it doesn't bundle pidlockfile anymore
+# instead it depends on lockfile-0.9.1 which uses pidfile.
+pid_file_module = extras.try_import(['daemon.pidlockfile', 'daemon.pidfile'])
 
 import logging.config
 import os