Skip to content

Commit

Permalink
Implement skip
Browse files Browse the repository at this point in the history
  • Loading branch information
arjun-menon committed Jul 30, 2024
1 parent c406334 commit 6dfcd30
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion alteza/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,35 @@ def walk(dirNode: DirNode, env: dict[str, Any]) -> None:

env |= self.getModuleVars(self.runConfigIfAny(dirNode, env))

# TODO: Implement `skip`.
# Process `skip`:
skipNames = []
if "skip" in env:
skipVar = env["skip"]
if isinstance(skipVar, list):
for skipName in skipVar:
if isinstance(skipName, str):
skipNames.append(skipName)
else:
raise AltezaException(
"`skip` must be a list of strings representing names to be skipped.\n"
+ f"`{skipName}` is not a string."
)
else:
raise AltezaException("`skip` must be a list of names.")

# Ordering Note: We must recurse into the subdirectories first.
for d in dirNode.subDirs:
if d.dirName in skipNames:
continue
with enterDir(d.dirName):
walk(d, env)

# Ordering Note: Files in the current directory must be processed after
# all subdirectories have been processed so that they have access to
# information about the subdirectories.
for pyPageNode in dirNode.getPyPagesOtherThanIndex():
if pyPageNode.realName in skipNames:
continue
self.invokePyPage(pyPageNode, env)

# We must process the index file last.
Expand Down

0 comments on commit 6dfcd30

Please sign in to comment.