python类clone_from()的实例源码

updater.py 文件源码 项目:SuperOcto 作者: mcecchi 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def update_updater(self, *args):
        #if self.printer_model == 'Robo R2':
        #    branch = 'r2'
        #else:
        #    branch = 'c2'
        branch = 'master'

        if os.path.exists(self.repo_local_path):
            def del_rw(action, name, exc):
                os.chmod(name, stat.S_IWRITE)
                os.remove(name)
            # start fresh every time to avoid potential corruptions or misconfigurations
            rmtree(self.repo_local_path, onerror=del_rw)
        Repo.clone_from(self.repo_remote_path, self.repo_local_path, branch=branch)
utils.py 文件源码 项目:ggd-cli 作者: gogetdata 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def update_local_repo():
    if not os.path.isdir(LOCAL_REPO_DIR):
        os.makedirs(LOCAL_REPO_DIR)
    if not os.path.isdir(RECIPE_REPO_DIR):
        Repo.clone_from(GITHUB_URL, RECIPE_REPO_DIR)
    Repo(RECIPE_REPO_DIR).remotes.origin.pull()
py2.py 文件源码 项目:packyou 作者: llazzaro 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def clone_github_repo(self):
        """
            Clones a github repo with a username and repository_name
        """
        if not (self.username and self.repository_name):
            return
        repository_local_destination = join(MODULES_PATH, 'github', self.username, self.repository_name)
        if not exists(repository_local_destination):
            Repo.clone_from(self.repo_url, repository_local_destination, branch='master')
            init_filename = join(repository_local_destination, '__init__.py')
            open(init_filename, 'a').close()
py3.py 文件源码 项目:packyou 作者: llazzaro 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def clone_github_repo(self):
        """
            Clones a github repo with a username and repository_name
        """
        repository_local_destination = os.path.join(MODULES_PATH, 'github', self.username, self.repository_name)
        if not os.path.exists(repository_local_destination):
            Repo.clone_from(self.repo_url, repository_local_destination, branch='master')
            init_filename = os.path.join(repository_local_destination, '__init__.py')
            open(init_filename, 'a').close()
updater.py 文件源码 项目:RoboLCD 作者: victorevector 项目源码 文件源码 阅读 38 收藏 0 点赞 0 评论 0
def update_updater(self, *args):
        if self.printer_model == 'Robo R2':
            branch = 'r2'
        else:
            branch = 'c2'

        if os.path.exists(self.repo_local_path):
            # start fresh every time to avoid potential corruptions or misconfigurations
            rmtree(self.repo_local_path)
        Repo.clone_from(self.repo_remote_path, self.repo_local_path, branch=branch)
hero.py 文件源码 项目:Hero 作者: JDongian 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def clone(repo, path):
    """Clone a given repository object to the specified path.
    """
    try:
        shutil.rmtree(path)
    except FileNotFoundError:
        pass
    finally:
        logging.debug("cloning {}".format(repo.clone_url))
        repo_local = Repo.clone_from(repo.clone_url, path)
install.py 文件源码 项目:fame_modules 作者: certsocietegenerale 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def main():
    peepdf_path = os.path.join(VENDOR_ROOT, "peepdf")

    if not os.path.isfile(os.path.join(peepdf_path, "peepdf.py")):
        Repo.clone_from('https://github.com/jesparza/peepdf', peepdf_path)
install.py 文件源码 项目:fame_modules 作者: certsocietegenerale 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def main():
    try:
        import volatility
    except ImportError:
        volpath = os.path.join(VENDOR_ROOT, "volatility")
        setup_script = os.path.join(volpath, "setup.py")

        rmtree(volpath, True)
        Repo.clone_from("https://github.com/volatilityfoundation/volatility.git", volpath)

        os.chdir(volpath)
        call(['python', setup_script, 'install'])
install.py 文件源码 项目:fame_modules 作者: certsocietegenerale 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def main():
    decoders_path = os.path.join(VENDOR_ROOT, 'RATDecoders')

    if os.path.exists(decoders_path):
        repo = Repo(decoders_path)
        repo.remotes.origin.pull()
    else:
        Repo.clone_from("https://github.com/kevthehermit/RATDecoders.git", decoders_path)
__init__.py 文件源码 项目:Onyx 作者: OnyxProject 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def install(self):
        try:
            Repo.clone_from(self.url, self.app.config['SKILL_FOLDER'] + self.name)
            json.path = self.app.config['SKILL_FOLDER'] + self.name + "/package.json"
            data = json.decode_path()
            self.install_dep(data)
            self.install_pip(data)
            skill = get_skill_function(self.app.config['SKILL_FOLDER'], self.name)
            if (hasattr(skill, 'create_skill') and callable(skill.create_skill)):
                Module = skill.create_skill()
                if (hasattr(Module, 'install') and callable(Module.install)):
                    try:
                        Module.install()
                    except Exception as e:
                        logger.error('Install Skill error for ' + self.name + ' : ' + str(e))
                if (hasattr(Module, 'get_blueprint') and callable(Module.get_blueprint)):
                    self.app.register_blueprint(Module.get_blueprint())
            if data['navbar'] == 'True':
                navbar.folder = self.name
                navbar.set_plugin_navbar()
            os.system('cd ' + self.app.config['SKILL_FOLDER'] + self.name + ' && make compilelang')
            bot = kernel.set()
            kernel.train(bot)
            logger.info('Installation done with success')
            return json.encode({"status":"success"})
        except Exception as e:
            logger.error('Installation error : ' + str(e))
            return json.encode({"status":"error"})
__init__.py 文件源码 项目:Onyx 作者: OnyxProject 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def get_data(self):
        try:
            Repo.clone_from('https://github.com/OnyxProject/onyx-data', onyx.__path__[0] + "/data/")
            logger.info('Successfully get Data')
        except Exception as e:
            logger.error('Get Data error : ' + str(e))
            raise DataException(str(e))
openstack_git_repo.py 文件源码 项目:giftwrap 作者: openstack 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def clone(self, outdir):
        LOG.debug("Cloning '%s' to '%s'", self.url, outdir)
        kwargs = {'recursive': True}
        if self._depth:
            LOG.debug("Cloning with depth=%d", self._depth)
            kwargs['depth'] = self._depth
        self._repo = Repo.clone_from(self.url, outdir, **kwargs)
        git = self._repo.git
        git.checkout(self.branch)
        self._invalidate_attrs()
embedbot.py 文件源码 项目:embedbot 作者: Luigimaster1 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def update(ctx):
    await say(ctx.message, "Updating...")
    import platform
    try:
        from git import Repo
    except ImportError:
        await say(ctx.message, "Please install the module gitpython.".format(pip_os))
        return
    import shutil
    from distutils.dir_util import copy_tree
    import stat
    try:
        os.remove("oldconfig.json")
    except OSError:
        pass
    os.rename("config.json", "oldconfig.json")
    os.remove("embedbot.py") #lol r i p embedbot if this doesn't work r i p my work
    os.remove("README.md")
    os.remove("requirements.txt")
    repo_url = "https://www.github.com/Luigimaster1/embedbot.git"
    local_dir = "./tempupdate/"
    Repo.clone_from(repo_url, local_dir)
    def del_rw(action, name, exc):
        os.chmod(name, stat.S_IWRITE)
        os.remove(name)
    shutil.rmtree("./tempupdate/.git/", onerror=del_rw)
    copy_tree(local_dir, ".")
    shutil.rmtree("./tempupdate/", onerror=del_rw)
    os.remove("botinfo.json")
    await say(ctx.message, "The bot has been updated. Please restart the bot.")
osa_differ.py 文件源码 项目:osa_differ 作者: major 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def repo_clone(repo_dir, repo_url):
    """Clone repository to this host."""
    repo = Repo.clone_from(repo_url, repo_dir)
    return repo
truffleHog.py 文件源码 项目:truffleHog 作者: dxa4481 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def clone_git_repo(git_url):
    project_path = tempfile.mkdtemp()
    Repo.clone_from(git_url, project_path)
    return project_path
frontend.py 文件源码 项目:iguana 作者: iguana-project 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def clone_repository(repository):
        repo_url = repository.url
        repo_path = repository.get_local_repo_path()
        Frontend.set_auth(repository)

        try:
            repo = Repo.clone_from(repository.url, repository.get_local_repo_path(), branch='master')

            repository.conn_ok = True
        except:
            repository.conn_ok = False

        repository.save()
local_cache.py 文件源码 项目:coon 作者: comtihon 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def fetch(url, rev, path):
        repo = Repo.clone_from(url, path)
        if repo.bare:
            raise RuntimeError('Empty repo ' + url)
        git = repo.git
        git.checkout(rev)
        repo.create_head(rev)
        return repo.head.object.hexsha
repo_manager.py 文件源码 项目:mergeit 作者: insolite 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def get_repo(self):
        path = self.get_path()
        if os.path.exists(path):
            self.logger.info('found_repo')
            return Repo(path)
        self.logger.info('cloning_repo')
        return Repo.clone_from(self.uri, path)


问题


面经


文章

微信
公众号

扫码关注公众号