diff options
author | Annie Tallund <annie.tallund@arm.com> | 2023-01-31 16:20:12 +0100 |
---|---|---|
committer | Annie Tallund <annie.tallund@arm.com> | 2023-02-10 12:54:45 +0100 |
commit | b863f8eaf0b2e2627fa9c5d2a51004fd8133cc68 (patch) | |
tree | 6ac932f81de1d326477f0716b1668e9bebae332e /src/mlia/target | |
parent | 3e3dcb9bd5abb88adcd85b4f89e8a81e7f6fa293 (diff) | |
download | mlia-b863f8eaf0b2e2627fa9c5d2a51004fd8133cc68.tar.gz |
MLIA-594 Save target profile configuration
Save the target profile file in the output directory.
Change-Id: I886e52cb922c5425e749b154bd67a5d294ce0201
Diffstat (limited to 'src/mlia/target')
-rw-r--r-- | src/mlia/target/config.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mlia/target/config.py b/src/mlia/target/config.py index ec3fb4c..bf603dd 100644 --- a/src/mlia/target/config.py +++ b/src/mlia/target/config.py @@ -7,6 +7,7 @@ from abc import ABC from abc import abstractmethod from dataclasses import dataclass from pathlib import Path +from shutil import copy from typing import Any from typing import cast from typing import TypeVar @@ -61,6 +62,19 @@ def get_target(target_profile: str | Path) -> str: return cast(str, profile["target"]) +def copy_profile_file_to_output_dir( + target_profile: str | Path, output_dir: str | Path +) -> bool: + """Copy the target profile file to output directory.""" + profile_file_path = get_profile_file(target_profile) + output_file_path = f"{output_dir}/{profile_file_path.stem}.toml" + try: + copy(profile_file_path, output_file_path) + return True + except OSError as err: + raise RuntimeError("Failed to copy profile file:", err.strerror) from err + + T = TypeVar("T", bound="TargetProfile") |