def __init__(self, manager, latest=True, release=None): assert(isinstance(manager, TrudManager)) self.manager = manager if latest is True: manager.getlatestrelease() self.release = Path(manager.latestrelease['file']).stem if release is not None: self.release = Path(release) breakdown = trudname(str(self.release)) self.org = breakdown['org'] self.name = breakdown['set'] self.version = breakdown['version'] self.date = breakdown['date'] self.fullname = breakdown['full'] self.folder = self.manager.folder / self.release
def getreleaselist(self): self.releases = [] soup = bs4.BeautifulSoup(self.action(self.subs[str(self.id)]['link'] + '/releases').text, 'html.parser') for element in soup.find_all('div', 'bx-pad'): release = {} release['file'] = element.find(class_='download-release').get('href') try: release['checksum'] = element.find('a', string=re.compile('Download checksum')).get('href') except: pass try: release['signature'] = element.find('a', string=re.compile('Download signature')).get('href') except: pass try: release['public key'] = element.find('a', string=re.compile('Download public key')).get('href') except: pass breakdown = versioning.trudname(Path(release['file']).stem) release['name'] = breakdown['full'] release['date'] = breakdown['date'] release['version'] = breakdown['version'] self.releases.append(release)
def localreleases(self): return [x for x in self.folder.iterdir() if x.is_dir() and versioning.trudname(x.name)]