예제 #1
0
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.
예제 #2
0
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.
예제 #3
0
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.
예제 #4
0
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.