コード例 #1
0
ファイル: PostCheck.py プロジェクト: pvalena/rpmlint
def check_syntax_script(prog, commandline, script):
    if not script:
        return False
    # TODO: test that "prog" is available/executable
    tmpfile, tmpname = Pkg.mktemp()
    try:
        tmpfile.write(script)
        tmpfile.close()
        ret = Pkg.getstatusoutput((prog, commandline, tmpname))
    finally:
        tmpfile.close()
        os.remove(tmpname)
    return ret[0]
コード例 #2
0
ファイル: PostCheck.py プロジェクト: pvalena/rpmlint
def check_syntax_script(prog, commandline, script):
    if not script:
        return False
    # TODO: test that "prog" is available/executable
    tmpfile, tmpname = Pkg.mktemp()
    try:
        tmpfile.write(script)
        tmpfile.close()
        ret = Pkg.getstatusoutput((prog, commandline, tmpname))
    finally:
        tmpfile.close()
        os.remove(tmpname)
    return ret[0]