Install¶
erpc.install ¶
eRPC binary installation helpers.
Inspired by py-geth <https://github.com/ethereum/py-geth>_'s install module.
Handles cross-platform binary download from GitHub releases with optional
SHA256 checksum verification.
GITHUB_RELEASES_URL
module-attribute
¶
Base URL for eRPC GitHub release artifacts.
PLATFORM_MAP
module-attribute
¶
PLATFORM_MAP: dict[tuple[str, str], str] = {('Linux', 'x86_64'): 'erpc_linux_amd64', ('Linux', 'aarch64'): 'erpc_linux_arm64', ('Darwin', 'x86_64'): 'erpc_darwin_amd64', ('Darwin', 'arm64'): 'erpc_darwin_arm64'}
Mapping of (system, machine) to release artifact names.
get_platform_binary_name ¶
Get the eRPC binary artifact name for the current platform.
Returns:
| Type | Description |
|---|---|
str
|
Artifact filename for the current OS and architecture. |
Raises:
| Type | Description |
|---|---|
ERPCError
|
If the current platform is not supported. |
Examples:
Source code in erpc/install.py
verify_checksum ¶
Verify the SHA256 checksum of a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Path to the file to verify. |
required |
expected_sha256
|
str
|
Expected lowercase hex-encoded SHA256 digest. |
required |
Raises:
| Type | Description |
|---|---|
ERPCError
|
If the checksum does not match. |
Examples:
Source code in erpc/install.py
install_erpc ¶
install_erpc(version: str | None = None, install_dir: str = '/usr/local/bin', binary_name: str = 'erpc', checksum: str | None = None) -> Path
Download and install eRPC binary from GitHub releases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str | None
|
Release version tag (e.g., |
None
|
install_dir
|
str
|
Directory to install the binary. Created if it doesn't exist. |
'/usr/local/bin'
|
binary_name
|
str
|
Name for the installed binary. |
'erpc'
|
checksum
|
str | None
|
Optional SHA256 hex digest for verification. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the installed binary. |
Raises:
| Type | Description |
|---|---|
ERPCError
|
If the platform is unsupported or checksum verification fails. |
Examples: