MCPcopy Create free account
hub / github.com/nodejs/node / _AddImportedDependencies

Method _AddImportedDependencies

tools/gyp/pylib/gyp/input.py:1743–1783  ·  view source on GitHub ↗

Given a list of direct dependencies, adds indirect dependencies that other dependencies have declared to export their settings. This method does not operate on self. Rather, it operates on the list of dependencies in the |dependencies| argument. For each dependency in

(self, targets, dependencies=None)

Source from the content-addressed store, hash-verified

1741 return dependencies
1742
1743 def _AddImportedDependencies(self, targets, dependencies=None):
1744 """Given a list of direct dependencies, adds indirect dependencies that
1745 other dependencies have declared to export their settings.
1746
1747 This method does not operate on self. Rather, it operates on the list
1748 of dependencies in the |dependencies| argument. For each dependency in
1749 that list, if any declares that it exports the settings of one of its
1750 own dependencies, those dependencies whose settings are "passed through"
1751 are added to the list. As new items are added to the list, they too will
1752 be processed, so it is possible to import settings through multiple levels
1753 of dependencies.
1754
1755 This method is not terribly useful on its own, it depends on being
1756 "primed" with a list of direct dependencies such as one provided by
1757 DirectDependencies. DirectAndImportedDependencies is intended to be the
1758 public entry point.
1759 """
1760
1761 if dependencies is None:
1762 dependencies = []
1763
1764 index = 0
1765 while index < len(dependencies):
1766 dependency = dependencies[index]
1767 dependency_dict = targets[dependency]
1768 # Add any dependencies whose settings should be imported to the list
1769 # if not already present. Newly-added items will be checked for
1770 # their own imports when the list iteration reaches them.
1771 # Rather than simply appending new items, insert them after the
1772 # dependency that exported them. This is done to more closely match
1773 # the depth-first method used by DeepDependencies.
1774 add_index = 1
1775 for imported_dependency in dependency_dict.get(
1776 "export_dependent_settings", []
1777 ):
1778 if imported_dependency not in dependencies:
1779 dependencies.insert(index + add_index, imported_dependency)
1780 add_index = add_index + 1
1781 index = index + 1
1782
1783 return dependencies
1784
1785 def DirectAndImportedDependencies(self, targets, dependencies=None):
1786 """Returns a list of a target&#x27;s direct dependencies and all indirect

Callers 1

Calls 2

getMethod · 0.65
insertMethod · 0.45

Tested by

no test coverage detected