def add_repo(self, repo, index_fn=None): """ Add a repo to the chain, i.e. read the index file of the url, parse it and update the index. """ if self.verbose: print "Adding repository:" print " URL:", repo repo = dist_naming.cleanup_reponame(repo) self.repos.append(repo) if index_fn: # for running the tests locally assert repo.startswith('file://') index_data = open(repo[7:] + index_fn).read() new_index = metadata.parse_depend_index(index_data) else: new_index = dict(self.connect(repo).query(type='egg')) for spec in new_index.itervalues(): add_Reqs_to_spec(spec) for distname, spec in new_index.iteritems(): dist = repo + distname self.index[dist] = spec self.groups[spec['cname']].append(dist)
def add_repo(self, repo, index_fn=None): """ Add a repo to the chain, i.e. read the index file of the url, parse it and update the index. """ if self.verbose: print "Adding repository:" print " URL:", repo repo = dist_naming.cleanup_reponame(repo) self.repos.append(repo) if index_fn: # for running the tests locally repo_path = uri_to_path(repo) index_data = open(join(repo_path, index_fn)).read() new_index = metadata.parse_depend_index(index_data) else: new_index = dict(self.connect(repo).query(type='egg')) for spec in new_index.itervalues(): add_Reqs_to_spec(spec) for distname, spec in new_index.iteritems(): dist = repo + distname self.index[dist] = spec self.groups[spec['cname']].append(dist)
def add_repo(self, repo, index_fn='index-depend.bz2'): """ Add a repo to the chain, i.e. read the index file of the url, parse it and update the index. """ if self.verbose: print "Adding repository:" print " URL:", repo repo = dist_naming.cleanup_reponame(repo) self.repos.append(repo) index_url = repo + index_fn if index_url.startswith('file://'): if isfile(index_url[7:]): # A local url with index file if self.verbose: print " found index", index_url else: # A local url without index file self.index_all_files(repo) return if self.verbose: print " index:", index_fn faux = StringIO() write_data_from_url(faux, index_url) index_data = faux.getvalue() faux.close() if self.verbose: import hashlib print " md5:", hashlib.md5(index_data).hexdigest() print if index_fn.endswith('.bz2'): index_data = bz2.decompress(index_data) new_index = metadata.parse_depend_index(index_data) for spec in new_index.itervalues(): add_Reqs_to_spec(spec) for distname, spec in new_index.iteritems(): dist = repo + distname self.index[dist] = spec self.groups[spec['cname']].append(dist)
def add_repo(self, repo, index_fn='index-depend.txt'): """ Add a repo to the chain, i.e. read the index file of the url, parse it and update the index. """ if self.verbose: print "Adding repository:", repo repo = dist_naming.cleanup_reponame(repo) self.repos.append(repo) index_url = repo + index_fn if index_url.startswith('file://'): if isfile(index_url[7:]): # A local url with index file if self.verbose: print "\tfound index", index_url else: # A local url without index file self.index_all_files(repo) return if self.verbose: print "\treading:", index_url faux = StringIO() write_data_from_url(faux, index_url) index_data = faux.getvalue() faux.close() new_index = metadata.parse_depend_index(index_data) for spec in new_index.itervalues(): add_Reqs_to_spec(spec) for distname, spec in new_index.iteritems(): self.index[repo + distname] = spec