Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ version = "0.0.0"
description = ""
authors = [{name = "billwallis"}]
readme = "README.md"
license = {file = "LICENSE"}
requires-python = ">=3.13"
dependencies = []

Expand Down
19 changes: 16 additions & 3 deletions tools/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
]


def _copy_file_to_target(
source: pathlib.Path,
destination: pathlib.Path,
) -> None:
destination.parent.mkdir(parents=True, exist_ok=True)
shutil.copy(source, destination)


def copy_files_to_target(target: pathlib.Path) -> int:
if not target.exists():
logging.error(f"target {target} does not exist")
Expand All @@ -24,10 +32,15 @@ def copy_files_to_target(target: pathlib.Path) -> int:
logging.error(f"target {target} is not a directory")
return FAILURE

ret = SUCCESS
for file in FILES_TO_COPY:
shutil.copy(ROOT / file, target / file)
try:
_copy_file_to_target(source=ROOT / file, destination=target / file)
except Exception as e:
logging.error(str(e))
ret = FAILURE

return SUCCESS
return ret


def main(argv: Sequence[str] | None = None) -> int:
Expand All @@ -43,7 +56,7 @@ def main(argv: Sequence[str] | None = None) -> int:
if not args.targets:
parser.print_help()
for target in args.targets:
ret |= copy_files_to_target(target=pathlib.Path(target))
ret |= copy_files_to_target(target=pathlib.Path(target).resolve())

return ret

Expand Down