Skip to content

fontlab_instamix.legacy · declarations 001

Back to fontlab_instamix.legacy

LAUNCHER module-attribute

LAUNCHER

LEGACY_INSTALLER module-attribute

LEGACY_INSTALLER

MARKER module-attribute

MARKER

MENU module-attribute

MENU

MODULE module-attribute

MODULE

active_ids

active_ids(data: Path) -> list[str]

Ids with an active legacy install.

cleanup_shared

cleanup_shared(data: Path) -> list[Path]

Remove the shared legacy tools once no legacy install remains.

installed

installed(data: Path, ext_id: str) -> dict | None

The legacy install record of ext_id, if a legacy install is active.

last_state

last_state(path: Path) -> dict | None

The newest install/uninstall record in a legacy log, if any.

ledger_text_hash

ledger_text_hash(text: str) -> str

SHA-256 of generated text, as :func:ledger.sha256 hashes the written file.

log_path

log_path(data: Path, ext_id: str) -> Path

migrate

migrate(data: Path, ext_id: str, known: set[str], targets: set[str]) -> dict | None

Remove the legacy install of ext_id; return a summary, or None if nothing was done.

known holds SHA-256 digests of files instamix will install; targets holds data-relative POSIX paths it will create. A kept legacy file in the log's files at one of those targets would block the new install, so nothing is removed and :class:MigrationError lists the conflicts. Other files the log recorded (hashes, kept) at a target are older copies: they are moved to Extensions/.instamix/backup/<id>/<UTC>/. After an earlier migration the previous install record is used again.

move_aside

move_aside(data: Path, ext_id: str, state: dict, targets: set[str]) -> list[tuple[str, str]]

Move recorded files that sit at install targets into the backup folder.

Returns [(original, backup)]. Unrecorded files are never touched.

owns_folder

owns_folder(path: Path, state: dict) -> bool

True for the legacy lib/ (marker with our id) or a legacy dist-info.

plan

plan(data: Path, state: dict, known: set[str]) -> tuple[list[Path], list[tuple[str, str]]]

(paths to remove, [(path, reason)] to keep) for a legacy install record.

previous_install

previous_install(data: Path, ext_id: str) -> dict | None

The last install record of the log, even after a migrated_to uninstall.

restore

restore(moved: list, data: Path | None = None, ext_id: str | None = None) -> None

Put files moved by :func:move_aside back; log it when data and ext_id are given.