def remove_repo(self, rname): """todo: Docstring for remove_repo :param repo: arg description :type repo: type description :return: :rtype: """ logger.debug("%s", rname) repo = Repo(name=rname) repo.remove() return repo
def install_repo(self, repo, location=''): """todo: Docstring for install_repo :param repo: arg description :type repo: type description :return: :rtype: """ dst = location or settings.upkg_destdir # make sure the destination dir exists. if not os.path.exists(dst): os.makedirs(dst) # repo = Repo(url=repo, repo_dir=dst) repo = Repo(url=repo) repo.install() return repo
def update(self, repos): """ :param repos: arg description :type repos: type description :return: :rtype: """ logger.debug("repos: %s", repos) if repos: rlist = [Repo(name=x) for x in repos] else: # Update them all! rlist = Repo.installed_list() logger.debug("repo list: %s", rlist) for r in rlist: logger.debug("calling update on: %s", r) r.update()
def exec(self, args): """todo: Docstring for exec :param args: arg description :type args: type description :return: :rtype: """ logger.debug("query %s", args.query) pl = Repo.installed_list() if not pl: print("No packages installed, use 'upkg install'") idx = 1 for p in pl: print("[%s] %s" % (idx, p)) idx += 1
def status(self, repos): """ :param repos: arg description :type repos: type description :return: :rtype: """ logger.debug("repos: %s", repos) if repos: rlist = [Repo(name=x) for x in repos] else: # Update them all! rlist = Repo.installed_list() logger.debug("repo list: %s", rlist) t = Terminal() for r in rlist: logger.debug("calling status on: %s", r) rp = r.repo_dir rpw = len(rp) w = t.width bw = int(((w - rpw) / 2) - 1) nw = int(((w - len(r.name)) / 2) - 1) print(t.magenta("*" * w)) print(t.magenta("{} {} {}".format(" " * nw, r.name, " " * nw))) if (rpw + 2) < w: print(t.magenta("{} {} {}".format(" " * bw, rp, " " * bw))) else: print(t.magenta(rpw)) print(t.magenta("*" * w)) r.status() print("\n")