Skip to content

Commit

Permalink
Updated the fetch-dependencies.py script so that it supports the addi…
Browse files Browse the repository at this point in the history
…tional os column.
  • Loading branch information
razterizer committed Dec 10, 2024
1 parent ee46b15 commit d14c836
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions fetch-dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class Dependency:
path: Path
repo: str
ref: str
os: str


class CheckoutStatus(NamedTuple):
Expand All @@ -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)
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit d14c836

Please sign in to comment.