Skip to content

Web dependency

web_dependency

An ExternalDependency subclass able to download from a url.

WebDependency

An ExternalDependency subclass able to download from a url.

Able to download an uncrompressed, zip, or tar file from the web and can optionally compare the hash to a provided hash.

Attributes:

Name Type Description
internal_path str

Describes layout of what we're downloading. Include / at the beginning if the ext_dep is a directory. Item located at internal_path will unpacked into the ext_dep folder and this is what the path/shell vars will point to when compute_published_path is run.

compression_type str

Supports zip and tar. If the file isn't compressed, do not include this field. Optional

sha256 str

Hash of downloaded file to be checked against. Optional

Tip

The attributes are what must be described in the ext_dep yaml file!

__init__

__init__(descriptor: dict) -> None

Inits a web dependency based off the provided descriptor.

__str__

__str__() -> str

Returns a string representation.

linuxize_path staticmethod

linuxize_path(path: str) -> str

Replaces windows style separators with linux style separators.

Parameters:

Name Type Description Default
path str

the path

required

unpack staticmethod

unpack(
    compressed_file_path: str,
    destination: str,
    internal_path: str,
    compression_type: str,
) -> None

Unpacks a compressed file to the specified location; zip or tar supported.

Parameters:

Name Type Description Default
compressed_file_path str

Name of compressed file to unpack.

required
destination str

directory to unpacked into.

required
internal_path str

internal structure of the compressed volume that you would like extracted.

required
compression_type str

type of compression. tar and zip supported.

required

fetch

fetch() -> None

Fetches the dependency using internal state from the init.