Exemple #1
0
    def value_or_global_default(self,
                                python_setup: PythonSetup) -> Tuple[str, ...]:
        """Return either the given `compatibility` field or the global interpreter constraints.

        If interpreter constraints are supplied by the CLI flag, return those only.
        """
        return python_setup.compatibility_or_constraints(self.value)
Exemple #2
0
 def create_from_adaptors(
         cls, adaptors: Iterable[TargetAdaptor],
         python_setup: PythonSetup) -> "PexInterpreterConstraints":
     constraint_sets: Set[Iterable[str]] = set()
     for adaptor in adaptors:
         if not isinstance(adaptor, PythonTargetAdaptor):
             continue
         constraint_set = python_setup.compatibility_or_constraints(
             adaptor.compatibility)
         constraint_sets.add(constraint_set)
     # This will OR within each target and AND across targets.
     merged_constraints = cls.merge_constraint_sets(constraint_sets)
     return PexInterpreterConstraints(merged_constraints)