Skip to content

Commit

Permalink
input: make tool usage conditional
Browse files Browse the repository at this point in the history
Sometimes a recipe might only require a tool if certain conditions are
met. So far, tools could only be used unconditionally. This adds a new
syntax along the following lines:

  checkoutTools:
      - if: "${TEST_VAR:-}"
        name: graphics::package

Fixes #572.
  • Loading branch information
jkloetzke committed Aug 2, 2024
1 parent 9e546cc commit 5767a92
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 133 deletions.
12 changes: 6 additions & 6 deletions pym/bob/cmds/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def dumpPackage(package):
doc["checkoutTools"] = {
name : "/".join(t.getStep().getPackage().getStack())
for name, t in checkoutStep.getTools().items()
if name in (recipe.toolDepCheckout - recipe.toolDepCheckoutWeak)
if name in (checkoutStep.toolDep - checkoutStep.toolDepWeak)
}
doc["checkoutToolsWeak"] = {
name : "/".join(t.getStep().getPackage().getStack())
for name, t in checkoutStep.getTools().items()
if name in recipe.toolDepCheckoutWeak
if name in checkoutStep.toolDepWeak
}
doc["checkoutVars"] = {
k : v for k, v in checkoutStep.getEnv().items()
Expand All @@ -83,12 +83,12 @@ def dumpPackage(package):
doc["buildTools"] = {
name : "/".join(t.getStep().getPackage().getStack())
for name, t in buildStep.getTools().items()
if name in (recipe.toolDepBuild - recipe.toolDepBuildWeak)
if name in (buildStep.toolDep - buildStep.toolDepWeak)
}
doc["buildToolsWeak"] = {
name : "/".join(t.getStep().getPackage().getStack())
for name, t in buildStep.getTools().items()
if name in recipe.toolDepBuildWeak
if name in buildStep.toolDepWeak
}
doc["buildVars"] = {
k : v for k, v in buildStep.getEnv().items()
Expand All @@ -104,12 +104,12 @@ def dumpPackage(package):
doc["packageTools"] = {
name : "/".join(t.getStep().getPackage().getStack())
for name, t in packageStep.getTools().items()
if name in (recipe.toolDepPackage - recipe.toolDepPackageWeak)
if name in (packageStep.toolDep - packageStep.toolDepWeak)
}
doc["packageToolsWeak"] = {
name : "/".join(t.getStep().getPackage().getStack())
for name, t in packageStep.getTools().items()
if name in recipe.toolDepPackageWeak
if name in packageStep.toolDepWeak
}
doc["packageVars"] = {
k : v for k, v in packageStep.getEnv().items()
Expand Down
Loading

0 comments on commit 5767a92

Please sign in to comment.