Cambiato sistema di ricerca delle release - ora basate su DownloadPage.

This commit is contained in:
Emiliano Vavassori 2022-04-09 01:18:12 +02:00
parent ebf1e22b0a
commit e84f275f42
1 changed files with 16 additions and 5 deletions

View File

@ -6,6 +6,7 @@ from lxml import etree
from packaging.version import parse as parse_version
class BuildVersion(object):
DOWNLOADPAGE = "https://www.libreoffice.org/download/download/"
ARCHIVE = "https://downloadarchive.documentfoundation.org/libreoffice/old/"
RELEASE = "https://download.documentfoundation.org/libreoffice/stable/"
DAILY = "https://dev-builds.libreoffice.org/daily/master/Linux-rpm_deb-x86_64@tb87-TDF/"
@ -67,13 +68,23 @@ class BuildVersion(object):
return { 'version': version, 'basedirurl': basedirurl }
# Stable releases.
versions = etree.HTML(urllib.request.urlopen(BuildVersion.RELEASE).read()).xpath('//td/a')
index = 1
# Old approach - Doesn't really work because RelEng can screw order.
#versions = etree.HTML(urllib.request.urlopen(BuildVersion.RELEASE).read()).xpath('//td/a')
#index = 1
#if branch == 'still':
# index = -2
#elif branch == 'fresh':
# index = -1
#version = self.__getlatestrel(versions[index].text.strip('/'))
# Now I'll rely on DownloadPage
versions = etree.HTML(urllib.request.urlopen(BuildVersion.DOWNLOADPAGE).read()).xpath('//span[@class="dl_version_number"]')
index = 0
if branch == 'still':
index = -2
index = 1
elif branch == 'fresh':
index = -1
version = self.__getlatestrel(versions[index].text.strip('/'))
index = 0
version = self.__getlatestrel(versions[index].text)
return { 'version': version, 'basedirurl': self.__getbaseurl(version) }