def get_repo_doc(self, repo_name): repo = self.get_repo(repo_name) index_path = repo.indexuri.get_uri() # FIXME Local index files should also be cached. if File.is_compressed(index_path) or repo.indexuri.is_remote_file(): index = os.path.basename(index_path) index_path = util.join_path(ctx.config.index_dir(), repo_name, index) if File.is_compressed(index_path): index_path = os.path.splitext(index_path)[0] if not os.path.exists(index_path): ctx.ui.warning( _("{} repository needs to be updated").format(repo_name)) return xmlext.newDocument("INARY") try: return xmlext.parse(index_path) except Exception as e: raise RepoError( _("Error parsing repository index information: {} \n Index file does not exist or is malformed." ).format(e))
def _get_doc(self): if self._doc is None: repos_file = os.path.join(ctx.config.info_dir(), ctx.const.repos) if os.path.exists(repos_file): self._doc = xmlext.parse(repos_file) else: self._doc = xmlext.newDocument("REPOS") return self._doc