Skip to content

Commit db169c5

Browse files
committed
switch to postorder ordering to first process the external deps
1 parent e82af52 commit db169c5

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

python/private/attributes.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ The order of this list can matter because it affects the order that information
260260
from dependencies is merged in, which can be relevant depending on the ordering
261261
mode of depsets that are merged.
262262
263-
* {obj}`PyInfo.venv_symlinks` uses topological ordering.
263+
* {obj}`PyInfo.venv_symlinks` uses postorder ordering.
264264
265265
See {obj}`PyInfo` for more information about the ordering of its depsets and
266266
how its fields are merged.

python/private/py_executable.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ def _create_venv_symlinks(ctx, venv_dir_map):
653653
# NOTE: Topological ordering is used so that dependencies closer to the
654654
# binary have precedence in creating their symlinks. This allows the
655655
# binary a modicum of control over the result.
656-
order = "topological",
656+
order = "postorder",
657657
transitive = [
658658
dep[PyInfo].venv_symlinks
659659
for dep in ctx.attr.deps
@@ -688,7 +688,7 @@ def _build_link_map(entries):
688688

689689
for entry in entries:
690690
# We overwrite duplicates by design. The dependency closer to the
691-
# binary gets precedence due to the topological ordering.
691+
# binary gets precedence due to the postorder ordering.
692692

693693
if entry.package and version_by_pkg.get(entry.package) != entry.version:
694694
# If we detect that we are adding a different package version, clear the
@@ -704,13 +704,13 @@ def _build_link_map(entries):
704704

705705
if entry.venv_path in kind_map:
706706
# We ignore duplicates by design. The dependency closer to the
707-
# binary gets precedence due to the topological ordering.
707+
# binary gets precedence due to the postorder ordering.
708708
continue
709709
else:
710710
kind_map[entry.venv_path] = entry.link_to_path
711711

712712
# An empty link_to value means to not create the site package symlink.
713-
# Because of the topological ordering, this allows binaries to remove
713+
# Because of the postorder ordering, this allows binaries to remove
714714
# entries by having an earlier dependency produce empty link_to values.
715715
for link_map in pkg_link_map.values():
716716
for kind, kind_map in link_map.items():

python/private/py_info.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,13 @@ This field is currently unused in Bazel and may go away in the future.
309309
"venv_symlinks": """
310310
:type: depset[VenvSymlinkEntry]
311311
312-
A depset with `topological` ordering.
312+
A depset with `postorder` ordering.
313313
314314
:::{include} /_includes/experimental_api.md
315315
:::
316316
317317
:::{tip}
318-
The topological ordering means dependencies earlier and closer to the consumer
318+
The postorder ordering means dependencies earlier and closer to the consumer
319319
have precedence. This allows e.g. a binary to add dependencies that override
320320
values from further way dependencies, such as forcing symlinks to point to
321321
specific paths or preventing symlinks from being created.
@@ -378,7 +378,7 @@ def _PyInfoBuilder_typedef():
378378
:::{field} venv_symlinks
379379
:type: DepsetBuilder[tuple[str | None, str]]
380380
381-
NOTE: This depset has `topological` order
381+
NOTE: This depset has `postorder` order
382382
:::
383383
"""
384384

@@ -419,7 +419,7 @@ def _PyInfoBuilder_new():
419419
transitive_pyc_files = builders.DepsetBuilder(),
420420
transitive_pyi_files = builders.DepsetBuilder(),
421421
transitive_sources = builders.DepsetBuilder(),
422-
venv_symlinks = builders.DepsetBuilder(order = "topological"),
422+
venv_symlinks = builders.DepsetBuilder(order = "postorder"),
423423
)
424424
return self
425425

python/private/py_library.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ likely lead to conflicts with other targets that contribute to the namespace.
9393
9494
:::{tip}
9595
This attributes populates {obj}`PyInfo.venv_symlinks`, which is
96-
a topologically ordered depset. This means dependencies closer and earlier
96+
a `postorder` ordered depset. This means dependencies closer and earlier
9797
to a consumer have precedence. See {obj}`PyInfo.venv_symlinks` for
9898
more information.
9999
:::

0 commit comments

Comments
 (0)