| 68 | self.add_distribution(resolved_dist.fingerprinted_distribution) |
| 69 | |
| 70 | def configure( |
| 71 | self, |
| 72 | pex_builder, # type: PEXBuilder |
| 73 | dependency_configuration=DependencyConfiguration(), # type: DependencyConfiguration |
| 74 | ): |
| 75 | # type: (...) -> None |
| 76 | |
| 77 | dependency_configuration.configure(pex_builder.info) |
| 78 | |
| 79 | root_requirements_by_project_name = defaultdict( |
| 80 | OrderedSet |
| 81 | ) # type: DefaultDict[ProjectName, OrderedSet[Requirement]] |
| 82 | for root_req in self._requirements: |
| 83 | root_requirements_by_project_name[root_req.project_name].add(root_req) |
| 84 | |
| 85 | for fingerprinted_dist in self._distributions: |
| 86 | excluded_by = dependency_configuration.excluded_by(fingerprinted_dist.distribution) |
| 87 | if excluded_by: |
| 88 | excludes = " and ".join(map(str, excluded_by)) |
| 89 | root_reqs = root_requirements_by_project_name[fingerprinted_dist.project_name] |
| 90 | production_assert( |
| 91 | len(root_reqs) > 0, |
| 92 | "The deep --exclude mechanism failed to exclude {dist} from transitive " |
| 93 | "requirements. It should have been excluded by configured excludes: " |
| 94 | "{excludes} but was not.", |
| 95 | dist=fingerprinted_dist.distribution, |
| 96 | excludes=excludes, |
| 97 | ) |
| 98 | pex_warnings.warn( |
| 99 | "The distribution {dist} was required by the input {requirements} " |
| 100 | "{root_reqs} but ultimately excluded by configured excludes: " |
| 101 | "{excludes}".format( |
| 102 | dist=fingerprinted_dist.distribution, |
| 103 | requirements=pluralize(root_reqs, "requirement"), |
| 104 | root_reqs=" and ".join(map(str, root_reqs)), |
| 105 | excludes=excludes, |
| 106 | ) |
| 107 | ) |
| 108 | continue |
| 109 | pex_builder.add_distribution( |
| 110 | dist=fingerprinted_dist.distribution, fingerprint=fingerprinted_dist.fingerprint |
| 111 | ) |
| 112 | |
| 113 | for requirement in self._requirements: |
| 114 | pex_builder.add_requirement(requirement) |