def index_all_files(self, repo): """ Add all distributions to the index, see index_file() above. Note that no index file is written to disk. """ dir_path = dist_naming.dirname_repo(repo) assert isdir(dir_path), dir_path for fn in os.listdir(dir_path): if not fn.endswith('.egg'): continue if not dist_naming.is_valid_eggname(fn): print "WARNING: ignoring invalid egg name:", join(dir_path, fn) continue self.index_file(fn, repo)
def index_file(self, filename, repo): """ Add an unindexed distribution, which must already exist in a local repository to the index (in memory). Note that the index file on disk remains unchanged. """ assert filename == basename(filename), filename dist = repo + filename if self.verbose: print "Adding %r to index" % dist arcname = 'EGG-INFO/spec/depend' z = zipfile.ZipFile(join(dist_naming.dirname_repo(repo), filename)) if arcname not in z.namelist(): z.close() raise Exception("zipfile %r has no arcname=%r" % (filename, arcname)) spec = metadata.parse_data(z.read(arcname)) z.close() add_Reqs_to_spec(spec) self.index[dist] = spec self.groups[spec['cname']].append(dist)