from git import Repo import os class FormulaRepo(): # class variables repo_url = '' repo_path = '' repo = None # class constructor def __init__(self, formula): self.repo_url = formula.git_url self.repo_path = formula.local_path # retrieves repo from remote location def retrieve(self): # check if the destination directory exists if not os.path.exists(self.repo_path): # clone git repo print('Downloading ' + git_url + ' into ' + self.repo_path) self.repo = Repo.clone_from(repo_url, self.repo_path) else: # let the user know it's already downloaded so we'll update it later print(self.repo_path + ' already exists, so we\'re not downloading it again.') self.repo = Repo(self.repo_path)