Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional tools #576

Merged
merged 5 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading