fix "fdroidserver/build.py:41: redefinition of unused 'paramiko' from line 39"

pyflakes gave this error based on the `paramiko = None` statement. I used
a different way to test whether paramiko was successfully imported that is
directly based on the relevant Exceptions.
This commit is contained in:
Hans-Christoph Steiner 2014-05-01 22:46:51 -04:00
parent 17b7f192b5
commit d564c37c35

View file

@ -37,8 +37,8 @@ from common import BuildException, VCSException, FDroidPopen, SilentPopen
try: try:
import paramiko import paramiko
except: except ImportError:
paramiko = None pass
def get_builder_vm_id(): def get_builder_vm_id():
vd = os.path.join('builder', '.vagrant') vd = os.path.join('builder', '.vagrant')
@ -244,7 +244,9 @@ def release_vm():
def build_server(app, thisbuild, vcs, build_dir, output_dir, force): def build_server(app, thisbuild, vcs, build_dir, output_dir, force):
"""Do a build on the build server.""" """Do a build on the build server."""
if not paramiko: try:
paramiko
except NameError:
raise BuildException("Paramiko is required to use the buildserver") raise BuildException("Paramiko is required to use the buildserver")
if options.verbose: if options.verbose:
logging.getLogger("paramiko").setLevel(logging.DEBUG) logging.getLogger("paramiko").setLevel(logging.DEBUG)