def test_package(d):
    def _run():
        for bcmd in [["configure"], ["build"], ["install", "--list-files"]]:
            cmd = [bentomaker] + bcmd
            p = subprocess.Popen(cmd, cwd=test, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
            p.wait()
            if p.returncode:
                print(p.stdout.read().decode())
                return False
        return True
    if use_waf(d) and not "WAFDIR" in os.environ:
        print("waf test and WAFDIR not set, skipped")
        return True
    if os.path.exists(os.path.join(d, "build")):
        shutil.rmtree(os.path.join(d, "build"))
    if _run():
        # We run twice to check that re-running commands with various bento caching
        # does not blow up
        return _run()
    else:
        return False
dataset/ETHPy150Open cournape/Bento/check_examples.py/test_package/original