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

Add Firefox major version support (#668) #675

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
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
4 changes: 3 additions & 1 deletion mozdownload/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def thunderbird_latest_version_filter(x):


def latest_version_filter(version, application):
if application == "firefox" and version.isnumeric():
return fr'^{version}(\.\d+)+(-candidates)?$'
if application == "thunderbird" and version == "latest":
return thunderbird_latest_version_filter
return RELEASE_AND_CANDIDATE_LATEST_VERSIONS[version]
Expand Down Expand Up @@ -722,7 +724,7 @@ def get_build_info(self):

def query_versions(self, version=None):
"""Check specified version and resolve special values."""
if version not in RELEASE_AND_CANDIDATE_LATEST_VERSIONS:
if version not in RELEASE_AND_CANDIDATE_LATEST_VERSIONS and not version.isnumeric():
return [version]

url = urljoin(self.base_url, 'releases/')
Expand Down
piri-p marked this conversation as resolved.
Show resolved Hide resolved
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions tests/release_scraper/test_release_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
({'platform': 'win32', 'version': '23.0.1'},
'firefox-23.0.1.en-US.win32.exe',
'firefox/releases/23.0.1/win32/en-US/Firefox Setup 23.0.1.exe'),
({'platform': 'win32', 'version': '23'},
piri-p marked this conversation as resolved.
Show resolved Hide resolved
'firefox-23.0.1.en-US.win32.exe',
'firefox/releases/23.0.1/win32/en-US/Firefox Setup 23.0.1.exe'),
({'platform': 'win32', 'version': '23.0'},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, for this specific test I would actually expect that the 23.0.1 release would be downloaded which is the latest security release of the 23.0 minor version. And we have this release already present for the testing data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this change because I added 23.1.0 test data to the folder, so 23 ==> 23.1.0 instead of 23.0.1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the test doesn't specify 23 but is more strict in requesting a version for 23.0. That means that we cannot allow a download of 23.1.x but have to stick to the minor version which is 23.0.x and as such we still need to return 23.0.1.

'firefox-23.0.en-US.win32.exe',
'firefox/releases/23.0/win32/en-US/Firefox Setup 23.0.exe'),
({'application': 'firefox', 'platform': 'win32', 'version': '23.0.1'},
'firefox-23.0.1.en-US.win32.exe',
'firefox/releases/23.0.1/win32/en-US/Firefox Setup 23.0.1.exe'),
Expand Down
Loading