Skip to content
Open
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
26 changes: 17 additions & 9 deletions vinca/recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,16 @@ def _adjust_requirements(requirements: Requirements, package_prefix: str) -> Non
{"if": "build_platform != target_platform", "then": [dependency]}
)

# doxygen is a build-machine doc generator; keeping it (or the graphviz it
# expands to) in `host` leaks graphviz's run_exports into `run` and its
# post-link caches into $PREFIX.
while "doxygen" in requirements["host"]:
requirements["host"].remove("doxygen")
requirements["build"].append("doxygen")

# These run on the build machine, so a target-platform build of them is useless:
# keep them in `host` only when not cross-compiling, and in `build` when we are.
for dependency in ("pyqt-builder", "git", "doxygen", "git-lfs"):
for dependency in ("pyqt-builder", "git", "git-lfs"):
_replace_with_selector(
requirements["host"],
dependency,
Expand Down Expand Up @@ -574,7 +581,7 @@ def generate_output(
resolved = resolve_pkgname(dependency, vinca_conf, distro)
if not resolved:
unsatisfied.add(dependency)
elif "git" in resolved:
elif "git" in resolved or "doxygen" in resolved:
output["requirements"]["build"].extend(resolved)
elif conditional_python and resolved == ["python"]:
pass
Expand All @@ -590,13 +597,14 @@ def generate_output(
}
)

_resolve_into(
build_dependencies,
output["requirements"]["host"],
vinca_conf,
distro,
unsatisfied,
)
for dependency in build_dependencies:
resolved = resolve_pkgname(dependency, vinca_conf, distro)
if not resolved:
unsatisfied.add(dependency)
elif "doxygen" in resolved:
output["requirements"]["build"].extend(resolved)
else:
output["requirements"]["host"].extend(resolved)
run_dependencies = (
_evaluated_dependency_names(
[
Expand Down
28 changes: 24 additions & 4 deletions vinca/test_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
"python-setuptools": ["setuptools"],
"cmake": ["cmake"],
"git": ["git"],
"doxygen": ["doxygen"],
"git-lfs": ["git-lfs"],
# matches robostack.yaml's real rosdep mapping: doxygen brings graphviz for dot
"doxygen": ["doxygen", "graphviz"],
"graphviz": ["graphviz"],
"cyclonedds": ["ros2-cyclonedds"],
"mimick_vendor": ["ros2-mimick-vendor"],
"pybind11_vendor": ["ros2-pybind11-vendor"],
Expand Down Expand Up @@ -438,17 +441,34 @@ def test_pybind11_vendor_pulls_in_pybind11():


def test_host_only_tools_are_split_across_build_and_host():
output = build("demo", depends=[("build_depend", "doxygen")])
output = build("demo", depends=[("build_depend", "git-lfs")])

assert {
"if": "build_platform == target_platform",
"then": ["doxygen"],
"then": ["git-lfs"],
} in output["requirements"]["host"]
assert {
"if": "build_platform != target_platform",
"then": ["doxygen"],
"then": ["git-lfs"],
} in output["requirements"]["build"]
assert "git-lfs" not in output["requirements"]["host"]


@pytest.mark.parametrize("tag", ["build_depend", "buildtool_depend"])
def test_doxygen_and_its_graphviz_go_to_build_not_host(tag):
output = build("demo", depends=[(tag, "doxygen")])

assert "doxygen" in output["requirements"]["build"]
assert "graphviz" in output["requirements"]["build"]
assert "doxygen" not in output["requirements"]["host"]
assert "graphviz" not in output["requirements"]["host"]


def test_direct_graphviz_dependency_stays_in_host():
output = build("demo", depends=[("build_depend", "graphviz")])

assert "graphviz" in output["requirements"]["host"]
assert "graphviz" not in output["requirements"]["build"]


def test_cyclonedds_gets_a_build_platform_copy():
Expand Down
Loading