def verifyPluginUsingVersionFlag(plugin_path, version_flag, vstring): """ Verifies a plugin by running it with I{version_flag} as the only command line argument and matching the output to I{vstring}. @return: 0 if there is a match. Otherwise, returns 1 @rtype: int @note: This is only useful if the plug-in supports a version flag arguments. """ if not plugin_path: return 1 if not os.path.exists(plugin_path): return 1 args = [version_flag] arguments = [] for arg in args: if arg != "": arguments.append(arg) p = Process() p.start(plugin_path, arguments) if not p.waitForFinished( 10000): # Wait for 10000 milliseconds = 10 seconds return 1 output = 'Not vstring' output = str(p.readAllStandardOutput()) #print "output=", output #print "vstring=", vstring if output.find(vstring) == -1: return 1 else: return 0 # Match found.
def verifyPluginUsingVersionFlag(plugin_path, version_flag, vstring): """ Verifies a plugin by running it with I{version_flag} as the only command line argument and matching the output to I{vstring}. @return: 0 if there is a match. Otherwise, returns 1 @rtype: int @note: This is only useful if the plug-in supports a version flag arguments. """ if not plugin_path: return 1 if not os.path.exists(plugin_path): return 1 args = [version_flag] arguments = [] for arg in args: if arg != "": arguments.append(arg) p = Process() p.start(plugin_path, arguments) if not p.waitForFinished (10000): # Wait for 10000 milliseconds = 10 seconds return 1 output = 'Not vstring' output = str(p.readAllStandardOutput()) #print "output=", output #print "vstring=", vstring if output.find(vstring) == -1: return 1 else: return 0 # Match found.
def verify_program(program, version_flag, vstring): """ Verifies a program by running it with the version_flag and matching the output to vstring. Returns 0 if there is a match. Otherwise, returns 1 """ if not program: return 1 if not os.path.exists(program): return 1 args = [version_flag] from processes.Process import Process arguments = [] for arg in args: if arg != "": arguments.append(arg) print print "arguments:", arguments p = Process() p.start(program, arguments) if not p.waitForFinished (10000): # Wait for 10000 milliseconds = 10 seconds return 1 output = 'Not vstring' output = str(p.readAllStandardOutput()) #print "output=", output #print "vstring=", vstring if output.find(vstring) == -1: return 1 else: return 0 # Match found.
def verify_program(program, version_flag, vstring): """ Verifies a program by running it with the version_flag and matching the output to vstring. Returns 0 if there is a match. Otherwise, returns 1 """ if not program: return 1 if not os.path.exists(program): return 1 args = [version_flag] from processes.Process import Process arguments = [] for arg in args: if arg != "": arguments.append(arg) print print "arguments:", arguments p = Process() p.start(program, arguments) if not p.waitForFinished(10000): # Wait for 10000 milliseconds = 10 seconds return 1 output = "Not vstring" output = str(p.readAllStandardOutput()) # print "output=", output # print "vstring=", vstring if output.find(vstring) == -1: return 1 else: return 0 # Match found.