def METHOD_NAME(target):
    packageName = "winpty-" + common_ship.winptyVersion + "-" + target["name"]
    if os.path.exists("ship\\packages\\" + packageName):
        shutil.rmtree("ship\\packages\\" + packageName)
    oldPath = os.environ["PATH"]
    os.environ["PATH"] = target["path"] + ";" + common_ship.defaultPathEnviron
    subprocess.check_call(["sh.exe", "configure"])
    makeBinary = target.get("make_binary", "make.exe")
    subprocess.check_call([makeBinary, "clean"])
    makeBaseCmd = [
        makeBinary,
        "USE_PCH=0",
        "COMMIT_HASH=" + common_ship.commitHash,
        "PREFIX=ship/packages/" + packageName
    ]
    subprocess.check_call(makeBaseCmd + ["all", "tests", "-j%d" % multiprocessing.cpu_count()])
    subprocess.check_call(["build\\trivial_test.exe"])
    subprocess.check_call(makeBaseCmd + ["install"])
    subprocess.check_call(["tar.exe", "cvfz",
        packageName + ".tar.gz",
        packageName], cwd=os.path.join(os.getcwd(), "ship", "packages"))
    os.environ["PATH"] = oldPath