normalize names and artifact paths
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ARTIFACTS_DIRNAME = "artifacts"
|
||||
|
||||
|
||||
def artifacts_dir(workspace_dir: str | Path) -> Path:
|
||||
return Path(workspace_dir) / ARTIFACTS_DIRNAME
|
||||
|
||||
|
||||
def runner_uses_library(runner_path: str | Path, library_path: str | Path) -> bool:
|
||||
runner_path = Path(runner_path)
|
||||
library_path = Path(library_path)
|
||||
try:
|
||||
return (
|
||||
runner_path.is_file()
|
||||
and library_path.is_file()
|
||||
and str(library_path.resolve()).encode() in runner_path.read_bytes()
|
||||
)
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
def remove_lock_files(root: str | Path) -> int:
|
||||
root = Path(root)
|
||||
if not root.exists():
|
||||
return 0
|
||||
removed = 0
|
||||
for path in root.rglob("*.lock"):
|
||||
if path.is_file() or path.is_symlink():
|
||||
path.unlink(missing_ok=True)
|
||||
removed += 1
|
||||
return removed
|
||||
Reference in New Issue
Block a user