From d14c836bbf8de01257084546defd02f07160a127 Mon Sep 17 00:00:00 2001 From: Rasmus Anthin Date: Tue, 10 Dec 2024 19:05:20 +0100 Subject: [PATCH] Updated the fetch-dependencies.py script so that it supports the additional os column. --- fetch-dependencies.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/fetch-dependencies.py b/fetch-dependencies.py index 0ab2e47..9e005c2 100755 --- a/fetch-dependencies.py +++ b/fetch-dependencies.py @@ -85,6 +85,7 @@ class Dependency: path: Path repo: str ref: str + os: str class CheckoutStatus(NamedTuple): @@ -99,8 +100,9 @@ def parse_dependencies(f) -> Iterator[Dependency]: match d: case [] | ['#', *_]: pass - case [path, repo, ref]: - yield Dependency(Path(path), repo, ref) + case [path, repo, ref, *os]: + os = os[0] if os else "any" + yield Dependency(Path(path), repo, ref, os) case _: print(f'Error in dependencies file. I do not understand line {i}.', file=sys.stderr) sys.exit(1) @@ -155,6 +157,18 @@ def parse_dependencies(f) -> Iterator[Dependency]: error = [] for d in deps: + skip = False; + # os = 'nt' | 'posix' | 'any' + match d.os: + case 'win': + if not os.name == 'nt': + skip = True; + case 'posix': + if not os.name == 'posix': + skip = True; + if skip: + continue; + dep_wc = (projects_dir / d.path).absolute() # If the dependency working copy does not exist yet, we can just clone it.