Skip to content

Commit

Permalink
Merge pull request #576 from jkloetzke/conditional-tools
Browse files Browse the repository at this point in the history
Conditional tools
  • Loading branch information
jkloetzke authored Aug 2, 2024
2 parents f6e486b + 52f4452 commit 39bd3ed
Show file tree
Hide file tree
Showing 6 changed files with 206 additions and 162 deletions.
19 changes: 18 additions & 1 deletion doc/manual/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ Other than the above differences setup scripts are identical to
{checkout,build,package}Tools
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Type: List of strings
Type: List of strings or tool dictionaries

This is a list of tools that should be added to ``$PATH`` during the execution
of the respective checkout/build/package script. A tool denotes a folder in an
Expand All @@ -623,6 +623,23 @@ added to ``$LD_LIBRARY_PATH``. The order of tools in ``$PATH`` and
separate set of executables so that the order of their inclusion does not
matter.

In the simple form, a tool is only specified as simple string. This will use
the tool unconditionally::

checkoutTools: [foo, bar]

If necessary, a tool can also be used conditionally. In this case the tool
is specified as a dictionary of the mandatory ``name`` and an optional ``if``
condition::

checkoutTools:
- name: foo
if: "$CONDITION"
- bar

The conditions will be checked with the final environment of a package, that is
after all dependencies of a recipe have been traversed.

A tool that is consumed in one step is also set in the following. This means a
tool consumed through checkoutTools is also available during the build and
package steps. Likewise a tool consumed by buildTools is available in the
Expand Down
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 39bd3ed

Please sign in to comment.