add.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:skymod 作者: DelusionalLogic 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号