def expand(self):
assert(self.state == TransactionState.INIT)
(expanded, missing) = self._expand_depedencies(
self.local_repo,
self.repo,
self.targets,
exclude=self.removes
)
if len(missing) > 0:
raise MissingDependencyError(missing)
self.depend_G = super().packages_to_graph(expanded)
try:
cycle = next(nx.simple_cycles(self.depend_G))
except StopIteration:
pass
else:
raise TransactionCycleError(cycle)
self._sort_deps_to_targets()
# Find all the packages that are upgrades rather than installs
for package in expanded:
if not package.is_local:
# Search for just the name to check if we have any version
# locally
q = Query(package.name)
local_package = self.local_repo.find_package(q)
# If we have something we want to remove it first, we call that
# an "upgrade"
if local_package is None:
continue
self.removes.append(local_package)
conflicts = super()._find_conflicts(self.installs, self.local_repo)
if len(conflicts) > 0:
# There were at least some conflicts
raise ConflictError(conflicts)
self.state = TransactionState.EXPANDED
评论列表
文章目录