# -*- coding: utf-8 -*- from traceback import print_exc from module.common.packagetools import parseNames from module.utils import to_list, has_method, uniqify from module.utils.fs import exists, remove, fs_encode from Base import Base, Retry class Package: """ Container that indicates that a new package should be created """ def __init__(self, name, urls=None): self.name = name self.urls = urls if urls else [] # nested packages self.packs = [] def addURL(self, url): self.urls.append(url) def addPackage(self, pack): self.packs.append(pack) def getAllURLs(self): urls = self.urls for p in self.packs: urls.extend(p.getAllURLs()) return urls # same name and urls is enough to be equal for packages def __eq__(self, other): return self.name == other.name and self.urls == other.urls def __repr__(self): return u"