Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace packaging.LegacyVersion use with mozilla_version. Fixes #635 #638

Merged
merged 4 commits into from
Apr 17, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion mozdownload/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@
}


def thunderbird_latest_version_filter(x):
invalid_versions = ("0.7rc", "1.0rc", "2.0.0.0", "2.0.0.0rc1", "10.0-real")
jfx2006 marked this conversation as resolved.
Show resolved Hide resolved
return x not in invalid_versions and\
re.match(RELEASE_AND_CANDIDATE_LATEST_VERSIONS['latest'], x)


def latest_version_filter(version, application):
if application == "thunderbird" and version == "latest":
return thunderbird_latest_version_filter
return RELEASE_AND_CANDIDATE_LATEST_VERSIONS[version]


class Scraper(object):
"""Generic class to download a Gecko based application."""

Expand Down Expand Up @@ -672,7 +684,7 @@ def query_versions(self, version=None):
url = urljoin(self.base_url, 'releases/')
parser = self._create_directory_parser(url)
if version:
versions = parser.filter(RELEASE_AND_CANDIDATE_LATEST_VERSIONS[version])
versions = parser.filter(latest_version_filter(version, self.application))
from mozilla_version import gecko
MozVersion = getattr(gecko, APPLICATIONS_TO_VERSION_CLASS[self.application])
versions.sort(key=MozVersion.parse)
Expand Down