__init__.py 文件源码

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

项目:urban-journey 作者: urbanjourney 项目源码 文件源码
def git_clone(self, name, source):
        """
        Clone the plugin from git repository.

        :param name: Plugin name.
        :param source: Source url.
        :returns: ``True`` if successful.
        :rtype: bool
        """
        if git_available:
            target_dir = join(self.path, "plugins", name)
            temp_dir = join(self.path, "plugins", "temp_" + name)

            try:
                # Clone repository to temporary folder
                repo = Repo.clone_from(source, temp_dir)
                self.print("cloned '{}' from '{}'".format(name, source))
            except:
                return False

            # Check if valid uj project.
            try:
                UjProject(temp_dir, self)
            except InvalidUjProjectError:
                return False

            # Delete old version of project if exiting
            rm(target_dir)

            # Move temp dir to target location and clean.
            move(temp_dir, target_dir)
            rm(temp_dir)
            return True
        else:
            return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号