Пример #1
0
def gen_pyenv_from_existing_archive(
        path_to_archive: str) -> PythonEnvDescription:

    archive_filename = os.path.basename(path_to_archive)

    packer = cluster_pack.detect_packer_from_file(path_to_archive)
    if packer == cluster_pack.PEX_PACKER:
        return PythonEnvDescription(path_to_archive, f"./{archive_filename}",
                                    archive_filename)
    elif packer == cluster_pack.CONDA_PACKER:
        return PythonEnvDescription(path_to_archive, f"{CONDA_CMD}",
                                    CONDA_ENV_NAME)
    else:
        raise ValueError(
            "Archive format unsupported. Must be .pex or conda .zip")
Пример #2
0
def detect_packer_from_file(zip_file: str) -> cluster_pack.Packer:
    return cluster_pack.detect_packer_from_file(zip_file)