1
0

Tentative prerelease support. Unfortunately requires the rewrite of most of the scripts, as it might provide multiple versions.

This commit is contained in:
Emiliano Vavassori 2022-04-24 22:38:40 +02:00
parent 380fd7029e
commit 638706ce2f

View File

@ -30,8 +30,18 @@ class BuildVersion(object):
else:
# String self.versions.
a = self.__getbranchrel(self.query)
self.version = a['version']
self.basedirurl = a['basedirurl']
if isinstance(a, list):
# If it's a list, a number of releases are provided.
self.version = []
self.basedirurl = []
for i in range(len(a)):
self.version[i] = self.__getlatestrel(a[i]['version'])
self.basedirurl[i] = a[i]['basedirurl']
else:
self.version = a['version']
self.basedirurl = a['basedirurl']
def __getlatestrel(self, basever):
"""Search in downloadarchive for the latest version matching baseversion."""
@ -62,10 +72,18 @@ class BuildVersion(object):
return { 'version': version + '-' + dailyversion, 'basedirurl': basedirurl }
if branch == 'prerelease':
version = etree.HTML(urllib.request.urlopen(BuildVersion.PRERELEASE).read()).xpath('//td/a')[1].text.split('_')[1]
# Also here, we'll rely on DownloadPage. Whenever a prerelease version is cited in the page.
version = etree.HTML(urllib.request.urlopen(BuildVersion.DOWNLOADPAGE).read()).xpath('//p[@class="lead_libre"][last()]/following-sibling::ul[last()]/li/a/text()')
retval = []
basedirurl = { u'x86': '-', u'x86_64': BuildVersion.PRERELEASE }
return { 'version': version, 'basedirurl': basedirurl }
if len(version) == 0:
return retval
for v in version:
retval.append({ 'version': v, 'basedirurl': basedirurl })
return retval
# Stable releases.
# Old approach - Doesn't really work because RelEng can screw order.