Ejemplo n.º 1
0
 def compare_with_working_set(
         self) -> Tuple[List[str], List[str], List[str]]:
     """Compares the candidates and return (to_add, to_update, to_remove)"""
     working_set = self.working_set
     to_update, to_remove = [], []
     candidates = self.candidates.copy()
     environment = self.environment.marker_environment
     for key, dist in working_set.items():
         if key in candidates:
             can = candidates.pop(key)
             if can.marker and not can.marker.evaluate(environment):
                 to_remove.append(key)
             elif not is_dist_editable(dist) and (
                     dist.version != can.version or can.req.editable):
                 to_update.append(key)
             elif is_dist_editable(dist) and not can.req.editable:
                 to_update.append(key)
         elif key not in self.all_candidates and key not in self.SEQUENTIAL_PACKAGES:
             # Remove package only if it is not required by any section
             # Packages for packaging will never be removed
             to_remove.append(key)
     to_add = list({
         strip_extras(name)[0]
         for name, can in candidates.items()
         if not (can.marker and not can.marker.evaluate(environment))
         and strip_extras(name)[0] not in working_set
     })
     return sorted(to_add), sorted(to_update), sorted(to_remove)
Ejemplo n.º 2
0
 def compare_with_working_set(
         self) -> Tuple[List[str], List[str], List[str]]:
     """Compares the candidates and return (to_add, to_update, to_remove)"""
     working_set = self.working_set
     to_update, to_remove = [], []
     candidates = self.candidates.copy()
     environment = self.environment.marker_environment
     for key, dist in working_set.items():
         if key in candidates:
             can = candidates.pop(key)
             if can.marker and not can.marker.evaluate(environment):
                 to_remove.append(key)
             elif not is_dist_editable(
                     dist) and dist.version != can.version:
                 # XXX: An editable distribution is always considered as consistent.
                 to_update.append(key)
         elif key not in self.all_candidates and key not in ("wheel",
                                                             "setuptools"):
             # Remove package only if it is not required by any section
             to_remove.append(key)
     to_add = list({
         strip_extras(name)[0]
         for name, can in candidates.items()
         if not (can.marker and not can.marker.evaluate(environment))
         and strip_extras(name)[0] not in working_set
     })
     return to_add, to_update, to_remove
Ejemplo n.º 3
0
    def compare_with_working_set(
            self) -> Tuple[List[str], List[str], List[str]]:
        """Compares the candidates and return (to_add, to_update, to_remove)"""
        working_set = self.working_set
        candidates = self.candidates.copy()
        to_update, to_remove = [], []

        for key, dist in working_set.items():
            if key == self.self_key:
                continue
            if key in candidates:
                can = candidates.pop(key)
                if (can.req.editable or is_dist_editable(dist)
                        or (dist.version != can.version)):
                    to_update.append(key)
            elif (key not in self.all_candidate_keys
                  and key not in self.SEQUENTIAL_PACKAGES):
                # Remove package only if it is not required by any section
                # Packages for packaging will never be removed
                to_remove.append(key)
        to_add = list({
            strip_extras(name)[0]
            for name, can in candidates.items() if name != self.self_key
            and strip_extras(name)[0] not in working_set
        })
        return (
            sorted(to_add),
            sorted(to_update),
            sorted(to_remove) if self.clean else [],
        )