Example #1
0
def setup_cyg_system(target):
    common_ship.mkdir("ship/tmp")

    systemDir = targetSystemDir(target)
    systemArchivePath = os.path.abspath(
        os.path.join("ship", "tmp", target["systemArchive"]))
    binPaths = [os.path.join(systemDir, p) for p in target["path"]]
    binPaths += common_ship.defaultPathEnviron.split(";")
    newPath = ";".join(binPaths)

    if not os.path.exists(systemDir):
        if not os.path.exists(systemArchivePath):
            subprocess.check_call([
                "curl.exe", "-fL", "-o", systemArchivePath,
                target["systemArchiveUrl"]
            ])
            assert os.path.exists(systemArchivePath)
        common_ship.checkSha256(systemArchivePath, target["systemArchiveSha"])
        subprocess.check_call(["7z.exe", "x", systemArchivePath],
                              cwd=os.path.dirname(systemDir))
        with common_ship.ModifyEnv(PATH=newPath):
            rebaseCmd = target["rebase"]
            rebaseCmd[0] = os.path.join(systemDir, rebaseCmd[0])
            subprocess.check_call(rebaseCmd)
    assert os.path.exists(systemDir)

    return newPath
Example #2
0
def build(arch, packageDir, xp=False):
    archInfo = ARCH_TABLE[arch]
    versionInfo = MSVC_VERSION_TABLE[ARGS.msvc_version]

    devCmdPath = os.path.join(os.environ[versionInfo["common_tools_env"]], "VsDevCmd.bat")
    if not os.path.isfile(devCmdPath):
        sys.exit("Error: MSVC environment script missing: " + devCmdPath)

    newEnv = os.environ.copy()
    newEnv["Path"] = os.path.dirname(sys.executable) + ";" + common_ship.defaultPathEnviron
    commandLine = (
        '"' + devCmdPath + '" && '
        " vcbuild.bat" +
        " --gyp-msvs-version " + versionInfo["gyp_version"] +
        " --version-suffix __none__" +
        " --msvc-platform " + archInfo["msvc_platform"]
    )

    subprocess.check_call(commandLine, shell=True, env=newEnv)

    archPackageDir = os.path.join(packageDir, arch)
    if xp:
        archPackageDir += "_xp"

    common_ship.mkdir(archPackageDir + "/bin")
    common_ship.mkdir(archPackageDir + "/lib")

    binSrc = os.path.join(common_ship.topDir, "src/Release", archInfo["msvc_platform"])

    shutil.copy(binSrc + "/winpty.dll",                 archPackageDir + "/bin")
    shutil.copy(binSrc + "/winpty-agent.exe",           archPackageDir + "/bin")
    shutil.copy(binSrc + "/winpty-debugserver.exe",     archPackageDir + "/bin")
    shutil.copy(binSrc + "/winpty.lib",                 archPackageDir + "/lib")
Example #3
0
def buildPackage():
    versionInfo = MSVC_VERSION_TABLE[ARGS.msvc_version]

    packageName = "winpty-%s-%s" % (
        common_ship.winptyVersion,
        versionInfo["package_name"],
    )

    packageRoot = os.path.join(common_ship.topDir, "ship/packages")
    packageDir = os.path.join(packageRoot, packageName)
    packageFile = packageDir + ".zip"

    common_ship.rmrf([packageDir])
    common_ship.rmrf([packageFile])
    common_ship.mkdir(packageDir)

    checkoutGyp()
    cleanMsvc()
    build("ia32", packageDir, True)
    build("x64", packageDir, True)
    cleanMsvc()
    build("ia32", packageDir)
    build("x64", packageDir)

    topDir = common_ship.topDir

    common_ship.mkdir(packageDir + "/include")
    shutil.copy(topDir + "/src/include/winpty.h", packageDir + "/include")
    shutil.copy(topDir + "/src/include/winpty_constants.h",
                packageDir + "/include")
    shutil.copy(topDir + "/LICENSE", packageDir)
    shutil.copy(topDir + "/README.md", packageDir)
    shutil.copy(topDir + "/RELEASES.md", packageDir)

    subprocess.check_call([ZIP_TOOL, "a", packageFile, "."], cwd=packageDir)