Make winexe an optional dependency
[snf-image-creator] / image_creator / winexe.py
index ebac409..b6c00bc 100644 (file)
@@ -38,6 +38,7 @@
 import subprocess
 import time
 import signal
+import distutils
 
 from image_creator.util import FatalError
 
@@ -50,6 +51,10 @@ class WinexeTimeout(FatalError):
 class WinEXE:
     """Wrapper class for the winexe command"""
 
+    @staticmethod
+    def is_installed(program='winexe'):
+        return distutils.spawn.find_executable(program) is not None
+
     def __init__(self, username, password, hostname, program='winexe'):
         self._host = hostname
         self._user = username