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
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions mozdownload/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
APPLICATIONS_TO_FTP_DIRECTORY = {'fennec': 'mobile'}
# Used if the application is named differently then the binary on the server
APPLICATIONS_TO_BINARY_NAME = {'devedition': 'firefox'}
# Used when sorting versions
APPLICATIONS_TO_VERSION_CLASS = {'devedition': 'DeveditionVersion',
'firefox': 'FirefoxVersion',
'fennec': 'FennecVersion',
'thunderbird': 'ThunderbirdVersion'}

# Base URL for the path to all builds
BASE_URL = 'https://archive.mozilla.org/pub/'
Expand Down Expand Up @@ -668,8 +673,9 @@ def query_versions(self, version=None):
parser = self._create_directory_parser(url)
if version:
versions = parser.filter(RELEASE_AND_CANDIDATE_LATEST_VERSIONS[version])
from packaging.version import LegacyVersion
versions.sort(key=LegacyVersion)
from mozilla_version import gecko
MozVersion = getattr(gecko, APPLICATIONS_TO_VERSION_CLASS[self.application])
versions.sort(key=MozVersion.parse)
return [versions[-1]]
else:
return parser.entries
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mozinfo >= 1.0.0
packaging >= 19.0
progressbar2 >= 3.34.3
redo==2.0.4
requests >= 2.21.0, <3.0.0
treeherder-client >= 5.0.0, <6.0.0
mozilla-version >= 1.2.0
jfx2006 marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion requirements/tests.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
coveralls[yaml]==3.3.1
packaging==21.3.0
pytest==7.2.1
pytest-cov==4.0.0
pytest-mock==3.10.0
Expand Down